mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 13:51:09 +08:00
FIX: "Replace Text" didn't list "Welcome Topic" when "General" category is missing (#27182)
Replacing the text of seeded topics doesn't require categories to exist, so this change removes that requirement for updates.
This commit is contained in:
@ -22,7 +22,10 @@ module SeedData
|
||||
|
||||
def update(site_setting_names: nil, skip_changed: false)
|
||||
I18n.with_locale(@locale) do
|
||||
topics(site_setting_names: site_setting_names).each do |params|
|
||||
topics(
|
||||
site_setting_names: site_setting_names,
|
||||
require_existing_categories: false,
|
||||
).each do |params|
|
||||
update_topic(**params.except(:category, :after_create), skip_changed: skip_changed)
|
||||
end
|
||||
end
|
||||
@ -38,7 +41,7 @@ module SeedData
|
||||
|
||||
def reseed_options
|
||||
I18n.with_locale(@locale) do
|
||||
topics
|
||||
topics(require_existing_categories: false)
|
||||
.map do |params|
|
||||
post = find_post(params[:site_setting_name])
|
||||
next unless post
|
||||
@ -51,7 +54,13 @@ module SeedData
|
||||
|
||||
private
|
||||
|
||||
def topics(site_setting_names: nil, include_welcome_topics: true, include_legal_topics: true)
|
||||
def topics(
|
||||
site_setting_names: nil,
|
||||
include_welcome_topics: true,
|
||||
include_legal_topics: true,
|
||||
require_existing_categories: true
|
||||
)
|
||||
general_category = Category.find_by(id: SiteSetting.general_category_id)
|
||||
staff_category = Category.find_by(id: SiteSetting.staff_category_id)
|
||||
feedback_category = Category.find_by(id: SiteSetting.meta_category_id)
|
||||
feedback_category_hashtag =
|
||||
@ -105,7 +114,7 @@ module SeedData
|
||||
|
||||
if include_welcome_topics
|
||||
# Welcome Topic
|
||||
if general_category = Category.find_by(id: SiteSetting.general_category_id)
|
||||
if general_category || !require_existing_categories
|
||||
site_info_quote =
|
||||
if SiteSetting.title.present? && SiteSetting.site_description.present?
|
||||
<<~RAW
|
||||
|
Reference in New Issue
Block a user