Class: SiteSetting
Defined Under Namespace
Classes: Upload
Constant Summary
collapse
- SAMPLE_TEST_PLUGIN =
Plugin::Instance.new(
Plugin::Metadata.new.tap { |metadata| metadata.name = "discourse-sample-plugin" },
)
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, categories, client_settings, client_settings_cache_key, client_settings_json, client_settings_json_uncached, current, default_locale, default_locale=, default_locale?, defaults, description, ensure_listen_for_changes, extended, filter_value, get, has_setting?, hidden_settings, info, listen_for_changes=, load_settings, mutex, notify_changed!, notify_clients!, placeholder, plugins, previews, process_id, process_message, provider, provider=, refresh!, refresh_settings, remove_override!, requires_refresh?, secret_settings, set, set_and_log, settings_hash, shadowed_settings, supported_types, type_supervisor, types
#sanitize_field
#setup_deprecated_methods
Class Method Details
.allowed_unicode_username_characters_regex ⇒ Object
140
141
142
143
144
145
146
147
148
149
|
# File 'app/models/site_setting.rb', line 140
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
84
85
86
87
88
89
|
# File 'app/models/site_setting.rb', line 84
def self.anonymous_homepage
.map { |item| item.name }
.select { |item| .include?(item) }
.first
end
|
80
81
82
|
# File 'app/models/site_setting.rb', line 80
def self.
@anonymous_menu_items ||= Set.new Discourse.anonymous_filters.map(&:to_s)
end
|
.available_locales ⇒ Object
48
49
50
|
# File 'app/models/site_setting.rb', line 48
def self.available_locales
LocaleSiteSetting.values.to_json
end
|
.blocked_attachment_content_types_regex ⇒ Object
122
123
124
125
126
127
128
129
|
# File 'app/models/site_setting.rb', line 122
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
131
132
133
134
135
136
137
138
|
# File 'app/models/site_setting.rb', line 131
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
117
118
119
120
|
# File 'app/models/site_setting.rb', line 117
def self.email_polling_enabled?
SiteSetting.manual_polling_enabled? || SiteSetting.pop3_polling_enabled? ||
DiscoursePluginRegistry.mail_pollers.any?(&:enabled?)
end
|
.first_post_length ⇒ Object
64
65
66
|
# File 'app/models/site_setting.rb', line 64
def self.first_post_length
min_first_post_length..max_post_length
end
|
.homepage ⇒ Object
76
77
78
|
# File 'app/models/site_setting.rb', line 76
def self.homepage
[0].name
end
|
260
261
262
|
# File 'app/models/site_setting.rb', line 260
def self.
SiteSetting. == "legacy"
end
|
.min_redirected_to_top_period(duration) ⇒ Object
105
106
107
|
# File 'app/models/site_setting.rb', line 105
def self.min_redirected_to_top_period(duration)
ListController.best_period_with_topics_for(duration)
end
|
.post_length ⇒ Object
60
61
62
|
# File 'app/models/site_setting.rb', line 60
def self.post_length
min_post_length..max_post_length
end
|
.private_message_post_length ⇒ Object
68
69
70
|
# File 'app/models/site_setting.rb', line 68
def self.private_message_post_length
min_personal_message_post_length..max_post_length
end
|
.private_message_title_length ⇒ Object
56
57
58
|
# File 'app/models/site_setting.rb', line 56
def self.private_message_title_length
min_personal_message_title_length..max_topic_title_length
end
|
.queue_jobs=(val) ⇒ Object
109
110
111
112
113
114
115
|
# File 'app/models/site_setting.rb', line 109
def self.queue_jobs=(val)
Discourse.deprecate(
"queue_jobs is deprecated. Please use Jobs.run_immediately! instead",
drop_from: "2.9.0",
)
val ? Jobs.run_later! : Jobs.run_immediately!
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
101
102
103
|
# File 'app/models/site_setting.rb', line 101
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
91
92
93
94
95
96
97
98
99
|
# File 'app/models/site_setting.rb', line 91
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
|
72
73
74
|
# File 'app/models/site_setting.rb', line 72
def self.
.split("|").map { || TopMenuItem.new() }
end
|
.topic_title_length ⇒ Object
52
53
54
|
# File 'app/models/site_setting.rb', line 52
def self.topic_title_length
min_topic_title_length..max_topic_title_length
end
|
.Upload ⇒ Object
202
203
204
|
# File 'app/models/site_setting.rb', line 202
def self.Upload
SiteSetting::Upload
end
|
.whispers_allowed_group_ids ⇒ Object
206
207
208
209
210
211
212
|
# File 'app/models/site_setting.rb', line 206
def self.whispers_allowed_group_ids
if SiteSetting.whispers_allowed_groups.present?
SiteSetting.whispers_allowed_groups_map
else
[]
end
end
|