A platform for community discussion. Free, open, simple.
FIX: store welcome topic id in custom field
Arpit Jalanffc8c52bf505
diff --git a/db/fixtures/990_topics.rb b/db/fixtures/990_topics.rbindex 1433f611d83..45bb8d42993 100644--- a/db/fixtures/990_topics.rb+++ b/db/fixtures/990_topics.rb@@ -42,6 +42,7 @@ if seed_welcome_topicspost = PostCreator.create(Discourse.system_user, raw: I18n.t('discourse_welcome_topic.body'), title: I18n.t('discourse_welcome_topic.title'), skip_validations: true)post.topic.update_pinned(true, true)+ TopicCustomField.create(topic_id: post.topic.id, name: "is_welcome_topic", value: "true")lounge = Category.find_by(id: SiteSetting.lounge_category_id)if loungediff --git a/lib/introduction_updater.rb b/lib/introduction_updater.rbindex 4868e7f22b9..60de29f5318 100644--- a/lib/introduction_updater.rb+++ b/lib/introduction_updater.rb@@ -20,7 +20,6 @@ class IntroductionUpdaterremaining = post.raw.split("\n")[1..-1]revisor.revise!(@user, raw: "#{new_value}\n#{remaining.join("\n")}")end-endprotected@@ -30,7 +29,12 @@ protectedenddef find_welcome_post- welcome_topic = Topic.listable_topics.where(slug: 'welcome-to-discourse').first+ topic_id = TopicCustomField.where(name: "is_welcome_topic").where(value: "true").pluck(:topic_id)+ unless topic_id.present?+ topic_id = Topic.listable_topics.where(slug: 'welcome-to-discourse').pluck(:id)+ end++ welcome_topic = Topic.find(topic_id).firstreturn nil unless welcome_topic.present?post = welcome_topic.posts.where(post_number: 1).first