UX: Various improvements to welcome topic CTA (#21010)

- Update welcome topic copy
- Edit the welcome topic automatically when the title or description changes
- Remove “Create your Welcome Topic” banner/CTA
- Add "edit welcome topic" user tip
This commit is contained in:
Bianca Nenciu
2023-05-12 16:09:40 +02:00
committed by GitHub
parent b85d057df4
commit b73a9a1faa
30 changed files with 86 additions and 487 deletions

View File

@ -65,4 +65,22 @@ DiscourseEvent.on(:site_setting_changed) do |name, old_value, new_value|
end
Emoji.clear_cache && Discourse.request_refresh! if name == :emoji_deny_list
if (name == :title || name == :site_description) &&
topic = Topic.find_by(id: SiteSetting.welcome_topic_id)
PostRevisor.new(topic.first_post, topic).revise!(
Discourse.system_user,
{
title: I18n.t("discourse_welcome_topic.title", site_title: SiteSetting.title),
raw:
I18n.t(
"discourse_welcome_topic.body",
base_path: Discourse.base_path,
site_title: SiteSetting.title,
site_description: SiteSetting.site_description,
),
},
skip_revision: true,
)
end
end