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

@@ -694,7 +694,6 @@ class PostRevisor
update_topic_excerpt
update_category_description
hide_welcome_topic_banner
end
def update_topic_excerpt
@@ -716,15 +715,6 @@ class PostRevisor
end
end
def hide_welcome_topic_banner
return unless guardian.is_admin?
return unless @topic.id == SiteSetting.welcome_topic_id
return unless Discourse.cache.read(Site.welcome_topic_banner_cache_key(@editor.id))
Discourse.cache.write(Site.welcome_topic_banner_cache_key(@editor.id), false)
MessageBus.publish("/site/welcome-topic-banner", false)
end
def advance_draft_sequence
@post.advance_draft_sequence
end

View File

@@ -84,8 +84,14 @@ module SeedData
if general_category = Category.find_by(id: SiteSetting.general_category_id)
topics << {
site_setting_name: "welcome_topic_id",
title: I18n.t("discourse_welcome_topic.title"),
raw: I18n.t("discourse_welcome_topic.body", base_path: Discourse.base_path),
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,
),
category: general_category,
after_create: proc { |post| post.topic.update_pinned(true, true) },
}

View File

@@ -18,18 +18,6 @@ module TopicQueryParams
: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
Site.welcome_topic_exists_and_is_not_edited?
end
end