Class: SiteSetting
Defined Under Namespace
Classes: Update, Upload
Constant Summary
collapse
- VALID_AREAS =
%w[flags about emojis permalinks]
- SAMPLE_TEST_PLUGIN =
Plugin::Instance.new(
Plugin::Metadata.new.tap { |metadata| metadata.name = "discourse-sample-plugin" },
)
SiteSettingExtension::HOSTNAME_SETTINGS
SiteSettings::DeprecatedSettings::OVERRIDE_TL_GROUP_SETTINGS, SiteSettings::DeprecatedSettings::SETTINGS
Class Method Summary
collapse
Methods included from GlobalPath
cdn_path, cdn_relative_path, full_cdn_url, path, upload_cdn_path
add_override!, after_fork, all_settings, areas, categories, client_settings, client_settings_cache_key, client_settings_json, client_settings_json_uncached, current, default_locale, default_locale=, default_locale?, defaults, deprecated_setting_alias, deprecated_settings, description, ensure_listen_for_changes, extended, filter_value, get, has_setting?, hidden_settings, hidden_settings_provider, info, keywords, listen_for_changes=, load_settings, mandatory_values, mutex, notify_changed!, notify_clients!, placeholder, plugins, previews, process_id, process_message, provider, provider=, refresh!, refresh_settings, remove_override!, requires_confirmation_settings, requires_refresh?, secret_settings, set, set_and_log, settings_hash, shadowed_settings, supported_types, type_supervisor, types, valid_areas
#sanitize_field
#group_to_tl, #is_tl_and_staff_setting?, #setup_deprecated_methods, #tl_to_group
Class Method Details
.allowed_unicode_username_characters_regex ⇒ Object
134
135
136
137
138
139
140
141
142
143
|
# File 'app/models/site_setting.rb', line 134
def self.allowed_unicode_username_characters_regex
current_db = RailsMultisite::ConnectionManagement.current_db
@allowed_unicode_username_regex ||= {}
@allowed_unicode_username_regex[current_db] ||= begin
if SiteSetting.allowed_unicode_username_characters.present?
Regexp.new(SiteSetting.allowed_unicode_username_characters)
end
end
end
|
.anonymous_homepage ⇒ Object
86
87
88
89
90
91
|
# File 'app/models/site_setting.rb', line 86
def self.anonymous_homepage
.map { |item| item.name }
.select { |item| .include?(item) }
.first
end
|
82
83
84
|
# File 'app/models/site_setting.rb', line 82
def self.
@anonymous_menu_items ||= Set.new Discourse.anonymous_filters.map(&:to_s)
end
|
.available_locales ⇒ Object
50
51
52
|
# File 'app/models/site_setting.rb', line 50
def self.available_locales
LocaleSiteSetting.values.to_json
end
|
.blocked_attachment_content_types_regex ⇒ Object
116
117
118
119
120
121
122
123
|
# File 'app/models/site_setting.rb', line 116
def self.blocked_attachment_content_types_regex
current_db = RailsMultisite::ConnectionManagement.current_db
@blocked_attachment_content_types_regex ||= {}
@blocked_attachment_content_types_regex[current_db] ||= begin
Regexp.union(SiteSetting.blocked_attachment_content_types.split("|"))
end
end
|
.blocked_attachment_filenames_regex ⇒ Object
125
126
127
128
129
130
131
132
|
# File 'app/models/site_setting.rb', line 125
def self.blocked_attachment_filenames_regex
current_db = RailsMultisite::ConnectionManagement.current_db
@blocked_attachment_filenames_regex ||= {}
@blocked_attachment_filenames_regex[current_db] ||= begin
Regexp.union(SiteSetting.blocked_attachment_filenames.split("|"))
end
end
|
.email_polling_enabled? ⇒ Boolean
111
112
113
114
|
# File 'app/models/site_setting.rb', line 111
def self.email_polling_enabled?
SiteSetting.manual_polling_enabled? || SiteSetting.pop3_polling_enabled? ||
DiscoursePluginRegistry.mail_pollers.any?(&:enabled?)
end
|
.first_post_length ⇒ Object
66
67
68
|
# File 'app/models/site_setting.rb', line 66
def self.first_post_length
min_first_post_length..max_post_length
end
|
.homepage ⇒ Object
78
79
80
|
# File 'app/models/site_setting.rb', line 78
def self.homepage
[0].name
end
|
.min_redirected_to_top_period(duration) ⇒ Object
107
108
109
|
# File 'app/models/site_setting.rb', line 107
def self.min_redirected_to_top_period(duration)
ListController.best_period_with_topics_for(duration)
end
|
.post_length ⇒ Object
62
63
64
|
# File 'app/models/site_setting.rb', line 62
def self.post_length
min_post_length..max_post_length
end
|
.private_message_post_length ⇒ Object
70
71
72
|
# File 'app/models/site_setting.rb', line 70
def self.private_message_post_length
min_personal_message_post_length..max_post_length
end
|
.private_message_title_length ⇒ Object
58
59
60
|
# File 'app/models/site_setting.rb', line 58
def self.private_message_title_length
min_personal_message_title_length..max_topic_title_length
end
|
.require_invite_code ⇒ Object
214
215
216
|
# File 'app/models/site_setting.rb', line 214
def self.require_invite_code
invite_code.present?
end
|
.scheme ⇒ Object
103
104
105
|
# File 'app/models/site_setting.rb', line 103
def self.scheme
force_https? ? "https" : "http"
end
|
.shared_drafts_enabled? ⇒ Boolean
255
256
257
258
|
# File 'app/models/site_setting.rb', line 255
def self.shared_drafts_enabled?
c = SiteSetting.shared_drafts_category
c.present? && c.to_i != SiteSetting.uncategorized_category_id.to_i
end
|
.should_download_images?(src) ⇒ Boolean
93
94
95
96
97
98
99
100
101
|
# File 'app/models/site_setting.rb', line 93
def self.should_download_images?(src)
setting = disabled_image_download_domains
return true if setting.blank?
host = URI.parse(src).host
!setting.split("|").include?(host)
rescue URI::Error
true
end
|
74
75
76
|
# File 'app/models/site_setting.rb', line 74
def self.
.split("|").map { || TopMenuItem.new() }
end
|
.topic_title_length ⇒ Object
54
55
56
|
# File 'app/models/site_setting.rb', line 54
def self.topic_title_length
min_topic_title_length..max_topic_title_length
end
|
.Upload ⇒ Object
210
211
212
|
# File 'app/models/site_setting.rb', line 210
def self.Upload
SiteSetting::Upload
end
|