mirror of
https://github.com/discourse/discourse.git
synced 2025-06-02 14:35:17 +08:00
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:
@ -261,74 +261,6 @@ RSpec.describe CategoriesController do
|
||||
end
|
||||
end
|
||||
|
||||
describe "welcome topic" do
|
||||
fab!(:category) { Fabricate(:category) }
|
||||
fab!(:topic1) do
|
||||
Fabricate(
|
||||
:topic,
|
||||
category: category,
|
||||
created_at: 5.days.ago,
|
||||
updated_at: Time.now,
|
||||
bumped_at: Time.now,
|
||||
)
|
||||
end
|
||||
fab!(:topic2) do
|
||||
Fabricate(:topic, category: category, created_at: 2.days.ago, bumped_at: 2.days.ago)
|
||||
end
|
||||
fab!(:topic3) do
|
||||
Fabricate(:topic, category: category, created_at: 1.day.ago, bumped_at: 1.day.ago)
|
||||
end
|
||||
fab!(:welcome_topic) { Fabricate(:topic) }
|
||||
fab!(:post) { Fabricate(:post, topic: welcome_topic) }
|
||||
|
||||
before do
|
||||
SiteSetting.desktop_category_page_style = "categories_and_latest_topics"
|
||||
SiteSetting.welcome_topic_id = welcome_topic.id
|
||||
SiteSetting.editing_grace_period = 1.minute.to_i
|
||||
SiteSetting.bootstrap_mode_enabled = true
|
||||
end
|
||||
|
||||
it "is hidden for non-admins" do
|
||||
get "/categories_and_latest.json"
|
||||
expect(response.status).to eq(200)
|
||||
expect(response.parsed_body["topic_list"]["topics"].map { |t| t["id"] }).not_to include(
|
||||
welcome_topic.id,
|
||||
)
|
||||
end
|
||||
|
||||
it "is shown to non-admins when there is an edit" do
|
||||
post.revise(post.user, { raw: "#{post.raw}2" }, revised_at: post.updated_at + 2.minutes)
|
||||
post.reload
|
||||
expect(post.version).to eq(2)
|
||||
|
||||
get "/categories_and_latest.json"
|
||||
expect(response.status).to eq(200)
|
||||
expect(response.parsed_body["topic_list"]["topics"].map { |t| t["id"] }).to include(
|
||||
welcome_topic.id,
|
||||
)
|
||||
end
|
||||
|
||||
it "is hidden to admins" do
|
||||
sign_in(admin)
|
||||
|
||||
get "/categories_and_latest.json"
|
||||
expect(response.status).to eq(200)
|
||||
expect(response.parsed_body["topic_list"]["topics"].map { |t| t["id"] }).not_to include(
|
||||
welcome_topic.id,
|
||||
)
|
||||
end
|
||||
|
||||
it "is shown to users when bootstrap mode is disabled" do
|
||||
SiteSetting.bootstrap_mode_enabled = false
|
||||
|
||||
get "/categories_and_latest.json"
|
||||
expect(response.status).to eq(200)
|
||||
expect(response.parsed_body["topic_list"]["topics"].map { |t| t["id"] }).to include(
|
||||
welcome_topic.id,
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
it "includes subcategories and topics by default when view is subcategories_with_featured_topics" do
|
||||
SiteSetting.max_category_nesting = 3
|
||||
subcategory = Fabricate(:category, user: admin, parent_category: category)
|
||||
|
Reference in New Issue
Block a user