Refresh the site after updating certain site settings

This commit is contained in:
riking 2014-02-20 21:52:11 -08:00
parent b3a860027f
commit ccd3e635d2
9 changed files with 29 additions and 6 deletions

View File

@ -533,7 +533,7 @@ da:
max_topic_title_length: "Maksimumlængde af emnetitel i tegn."
min_private_message_title_length: "Minimumlængde af titel på privat besked i tegn."
min_search_term_length: "Minimumlængde af søgeord i tegn."
allow_uncategorized_topics: "Tillad emner at blive oprettet uden en kategori. BEMÆRK: Efter ændring af denne indstilling skal alle klienter genindlæse siden for at ændringen slår igennem."
allow_uncategorized_topics: "Tillad emner at blive oprettet uden en kategori."
allow_duplicate_topic_titles: "Tillad emner med identiske titler"
unique_posts_mins: "Hvor mange minutter der skal gå før en bruger kan skrive et indlæg med det samme indhold igen."
enforce_global_nicknames: "Gennemtving unikke øgenavne (ADVARSEL: skift kun dette under den første opsætning)"

View File

@ -570,7 +570,7 @@ en:
max_topic_title_length: "Maximum topic title length in characters"
min_private_message_title_length: "Minimum title length for a private message in characters"
min_search_term_length: "Minimum search term length in characters"
allow_uncategorized_topics: "Allow topics to be created without a category. NOTE: After changing this setting, all clients will need to reload their browsers for the change to take effect."
allow_uncategorized_topics: "Allow topics to be created without a category."
allow_duplicate_topic_titles: "Allow topics with identical titles"
unique_posts_mins: "How many minutes before a user can make a post with the same content again"
enforce_global_nicknames: "Enforce global username uniqueness (WARNING: only change this during initial setup)"

View File

@ -521,7 +521,7 @@ fr:
max_topic_title_length: "Longueur maximale des titres de discussion en nombre de caractères"
min_private_message_title_length: "Longueur mimimale pour un titre de message privé en nombre de caractères"
min_search_term_length: "Longueur mimimale du texte saisie avant de lancer une recherche"
allow_uncategorized_topics: "Permettre la création de discussions sans catégorie. NOTE : Après la modification de ce paramètre tous les utilisateurs devront recharger leur navigateur pour que la modification prenne effet."
allow_uncategorized_topics: "Permettre la création de discussions sans catégorie."
allow_duplicate_topic_titles: "Permettre la création de discussions avec le même titre"
unique_posts_mins: "Combien de temps avant qu'un utilisateur puisse poster le même contenu à nouveau"
enforce_global_nicknames: "Imposer un pseudo global unique. (ATTENTION: fonctionne uniquement pendant la phase initiale de paramétrage)"

View File

@ -498,7 +498,7 @@ ja:
max_topic_title_length: "トピックタイトルの最大文字数"
min_private_message_title_length: "プライベートメッセージタイトルの最小文字数"
min_search_term_length: "検索語の最小文字数"
allow_uncategorized_topics: "カテゴリなしのトピック作成を許可するか。注意: 設定変更を反映させるためには、すべてのクライアントのブラウザをリロードする必要があります。"
allow_uncategorized_topics: "カテゴリなしのトピック作成を許可するか。"
allow_duplicate_topic_titles: "トピックタイトルの重複を許可するか"
unique_posts_mins: "同じ内容のポストを再投稿可能にする時間 (分)"
enforce_global_nicknames: "ニックネームのグローバルユニーク性を強制する (警告: この設定は初回セットアップ時にのみ変更してください)"

View File

@ -488,7 +488,7 @@ ko:
max_topic_title_length: "토픽 제목의 최대 글자 개수"
min_private_message_title_length: "개인 메시지 제목에서 필요한 최소 제목 길이"
min_search_term_length: "Minimum search term length in characters"
allow_uncategorized_topics: "카테고리없이 토픽이 생성되는 것을 허용한다. 참고: 이 세팅을 바꾼후에는 모든 사용자들이 새로고침을 하여야 합니다."
allow_uncategorized_topics: "카테고리없이 토픽이 생성되는 것을 허용한다."
allow_duplicate_topic_titles: "똑같은 제목을 가진 토픽을 허용"
unique_posts_mins: "How many minutes before a user can make a post with the same content again"
enforce_global_nicknames: "Enforce global nickname uniqueness (WARNING: only change this during initial setup)"

View File

@ -548,7 +548,7 @@ ru:
max_topic_title_length: 'Максимальная длина названия темы в символах'
min_private_message_title_length: 'Минимальная длина заголовка для личного сообщения'
min_search_term_length: 'Минимальная длина слова для поиска в символах'
allow_uncategorized_topics: 'Позволять создание тем без категории. Обратите внимание: После смены настройки все пользователи должны будут перегрузить кэш браузера.'
allow_uncategorized_topics: 'Позволять создание тем без категории.'
allow_duplicate_topic_titles: 'Разрешить создание тем с одинаковыми названиями'
unique_posts_mins: 'Количество минут до того, как пользователь сможет разместить сообщение с тем же содержанием.'
enforce_global_nicknames: 'Обеспечение глобальной уникальности имен пользователей (ПРЕДУПРЕЖДЕНИЕ: изменять только в процессе начальной настройки)'

View File

@ -24,6 +24,7 @@ basic:
default_locale:
default: 'en'
enum: 'LocaleSiteSetting'
refresh: true
allow_user_locale:
client: true
default: false
@ -180,6 +181,7 @@ posting:
allow_uncategorized_topics:
client: true
default: true
refresh: true
allow_duplicate_topic_titles: false
min_title_similar_length:
client: true
@ -269,6 +271,7 @@ files:
authorized_extensions:
client: true
default: '.jpg|.jpeg|.png|.gif'
refresh: true
crawl_images:
default:
test: false

View File

@ -172,6 +172,14 @@ module Discourse
!!$redis.get(readonly_mode_key)
end
def self.request_refresh!
# Causes refresh on next click for all clients
#
# This is better than `MessageBus.publish "/file-change", ["refresh"]` because
# it spreads the refreshes out over a time period
MessageBus.publish '/global/asset-version', 'clobber'
end
def self.git_version
return $git_version if $git_version

View File

@ -42,6 +42,10 @@ module SiteSettingExtension
@hidden_settings ||= []
end
def refresh_settings
@refresh_settings ||= []
end
def setting(name_arg, default = nil, opts = {})
name = name_arg.to_sym
mutex.synchronize do
@ -55,6 +59,9 @@ module SiteSettingExtension
if opts[:hidden] == true
hidden_settings << name
end
if opts[:refresh] == true
refresh_settings << name
end
setup_methods(name, current_value)
end
end
@ -204,9 +211,14 @@ module SiteSettingExtension
defaults.has_key?(name.to_sym) || defaults.has_key?("#{name}?".to_sym)
end
def requires_refresh?(name)
refresh_settings.include?(name.to_sym)
end
def set(name, value)
if has_setting?(name)
self.send("#{name}=", value)
Discourse.request_refresh! if requires_refresh?(name)
else
raise ArgumentError.new("No setting named #{name} exists")
end