FEATURE: Hide welcome topic if it hasn't been edited (#18632)

This commit is contained in:
Blake Erickson
2022-10-19 20:01:36 -06:00
committed by GitHub
parent 66904f2cd2
commit 505aec123f
3 changed files with 75 additions and 6 deletions

View File

@ -18,6 +18,19 @@ module TopicQueryParams
options[:topic_ids] = param_to_integer_list(:topic_ids)
options[:no_subcategories] = options[:no_subcategories] == 'true' if options[:no_subcategories].present?
if hide_welcome_topic?
options[:except_topic_ids] ||= []
options[:except_topic_ids] << SiteSetting.welcome_topic_id
end
options
end
private
def hide_welcome_topic?
return false if !SiteSetting.bootstrap_mode_enabled
return false if @guardian.is_admin?
Site.welcome_topic_exists_and_is_not_edited?
end
end