diff --git a/app/assets/javascripts/discourse/app/components/user-tip.js b/app/assets/javascripts/discourse/app/components/user-tip.js
index d85656f898d..791a95050bb 100644
--- a/app/assets/javascripts/discourse/app/components/user-tip.js
+++ b/app/assets/javascripts/discourse/app/components/user-tip.js
@@ -1,4 +1,5 @@
import { action } from "@ember/object";
+import { schedule } from "@ember/runloop";
import { inject as service } from "@ember/service";
import Component from "@glimmer/component";
import { hideUserTip } from "discourse/lib/user-tips";
@@ -13,19 +14,22 @@ export default class UserTip extends Component {
return;
}
- const { id, selector, content, placement } = this.args;
- this.currentUser.showUserTip({
- id,
+ schedule("afterRender", () => {
+ const { id, selector, content, placement } = this.args;
+ this.currentUser.showUserTip({
+ id,
- titleText: I18n.t(`user_tips.${id}.title`),
- contentText: content || I18n.t(`user_tips.${id}.content`),
+ titleText: I18n.t(`user_tips.${id}.title`),
+ contentText: content || I18n.t(`user_tips.${id}.content`),
- reference: selector
- ? element.parentElement.querySelector(selector) || element.parentElement
- : element,
- appendTo: element.parentElement,
+ reference: selector
+ ? element.parentElement.querySelector(selector) ||
+ element.parentElement
+ : element,
+ appendTo: element.parentElement,
- placement: placement || "top",
+ placement: placement || "top",
+ });
});
}
diff --git a/app/assets/javascripts/discourse/app/components/welcome-topic-banner.hbs b/app/assets/javascripts/discourse/app/components/welcome-topic-banner.hbs
deleted file mode 100644
index 32705dbafc8..00000000000
--- a/app/assets/javascripts/discourse/app/components/welcome-topic-banner.hbs
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
{{i18n "welcome_topic_banner.title"}}
-
{{i18n
- "welcome_topic_banner.description"
- }}
-
-
-
\ No newline at end of file
diff --git a/app/assets/javascripts/discourse/app/components/welcome-topic-banner.js b/app/assets/javascripts/discourse/app/components/welcome-topic-banner.js
deleted file mode 100644
index 205fc3538f1..00000000000
--- a/app/assets/javascripts/discourse/app/components/welcome-topic-banner.js
+++ /dev/null
@@ -1,32 +0,0 @@
-import Component from "@glimmer/component";
-import { action } from "@ember/object";
-import { getOwner } from "discourse-common/lib/get-owner";
-import Topic from "discourse/models/topic";
-import Composer from "discourse/models/composer";
-import { inject as service } from "@ember/service";
-
-export default class WelcomeTopicBanner extends Component {
- @service siteSettings;
- @service store;
-
- @action
- editWelcomeTopic() {
- const topicController = getOwner(this).lookup("controller:topic");
-
- Topic.find(this.siteSettings.welcome_topic_id, {}).then((topic) => {
- this.store
- .createRecord("topic", {
- id: topic.id,
- slug: topic.slug,
- })
- .postStream.loadPostByPostNumber(1)
- .then((post) => {
- post.topic.setProperties({
- draft_key: Composer.EDIT,
- "details.can_edit": true,
- });
- topicController.send("editPost", post);
- });
- });
- }
-}
diff --git a/app/assets/javascripts/discourse/app/controllers/discovery.js b/app/assets/javascripts/discourse/app/controllers/discovery.js
index 9a8d58b310d..ae0570b28bf 100644
--- a/app/assets/javascripts/discourse/app/controllers/discovery.js
+++ b/app/assets/javascripts/discourse/app/controllers/discovery.js
@@ -2,7 +2,6 @@ import Controller, { inject as controller } from "@ember/controller";
import { alias, equal, not } from "@ember/object/computed";
import { action } from "@ember/object";
import Category from "discourse/models/category";
-import discourseComputed from "discourse-common/utils/decorators";
import DiscourseURL from "discourse/lib/url";
import { inject as service } from "@ember/service";
@@ -22,24 +21,6 @@ export default Controller.extend({
loadedAllItems: not("discoveryTopics.model.canLoadMore"),
- @discourseComputed(
- "router.currentRouteName",
- "router.currentRoute.queryParams.f",
- "site.show_welcome_topic_banner"
- )
- showEditWelcomeTopicBanner(
- currentRouteName,
- hasParams,
- showWelcomeTopicBanner
- ) {
- return (
- this.currentUser?.staff &&
- currentRouteName === "discovery.latest" &&
- showWelcomeTopicBanner &&
- !hasParams
- );
- },
-
@action
loadingBegan() {
this.set("loading", true);
diff --git a/app/assets/javascripts/discourse/app/initializers/welcome-topic-banner.js b/app/assets/javascripts/discourse/app/initializers/welcome-topic-banner.js
deleted file mode 100644
index b00f24f83dc..00000000000
--- a/app/assets/javascripts/discourse/app/initializers/welcome-topic-banner.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import { bind } from "discourse-common/utils/decorators";
-
-export default {
- name: "welcome-topic-banner",
- after: "message-bus",
-
- initialize(container) {
- this.site = container.lookup("service:site");
- this.messageBus = container.lookup("service:message-bus");
-
- if (this.site.show_welcome_topic_banner) {
- this.messageBus.subscribe("/site/welcome-topic-banner", this.onMessage);
- }
- },
-
- teardown() {
- this.messageBus.unsubscribe("/site/welcome-topic-banner", this.onMessage);
- },
-
- @bind
- onMessage(disabled) {
- this.site.set("show_welcome_topic_banner", disabled);
- },
-};
diff --git a/app/assets/javascripts/discourse/app/lib/user-tips.js b/app/assets/javascripts/discourse/app/lib/user-tips.js
index bc1ceea1758..546db13ec6e 100644
--- a/app/assets/javascripts/discourse/app/lib/user-tips.js
+++ b/app/assets/javascripts/discourse/app/lib/user-tips.js
@@ -1,3 +1,4 @@
+import { isTesting } from "discourse-common/config/environment";
import { iconHTML } from "discourse-common/lib/icon-library";
import I18n from "I18n";
import { escape } from "pretty-text/sanitizer";
@@ -25,6 +26,7 @@ export function showUserTip(options) {
trigger: "manual",
theme: "user-tips",
zIndex: "",
+ delay: isTesting() ? 0 : 100,
// It must be interactive to make buttons work.
interactive: true,
diff --git a/app/assets/javascripts/discourse/app/templates/discovery.hbs b/app/assets/javascripts/discourse/app/templates/discovery.hbs
index 894678dadc7..39f859fbfd4 100644
--- a/app/assets/javascripts/discourse/app/templates/discovery.hbs
+++ b/app/assets/javascripts/discourse/app/templates/discovery.hbs
@@ -28,10 +28,6 @@
-{{#if this.showEditWelcomeTopicBanner}}
-
-{{/if}}
-
diff --git a/app/assets/javascripts/discourse/app/templates/topic.hbs b/app/assets/javascripts/discourse/app/templates/topic.hbs
index 1e817eb528e..c14399e29cc 100644
--- a/app/assets/javascripts/discourse/app/templates/topic.hbs
+++ b/app/assets/javascripts/discourse/app/templates/topic.hbs
@@ -149,6 +149,14 @@
class="edit-topic"
title={{i18n "edit"}}
>{{d-icon "pencil-alt"}}
+
+ {{#if (eq this.siteSettings.welcome_topic_id this.model.id)}}
+
+ {{/if}}
{{/if}}
:created_at",
- topic_id: SiteSetting.welcome_topic_id,
- created_at: 1.month.ago,
- )
- .exists?
- end
-
- def self.clear_show_welcome_topic_cache
- Discourse
- .cache
- .keys("show_welcome_topic_banner:*")
- .each { |key| Discourse.cache.redis.del(key) }
- end
-
- def self.show_welcome_topic_banner?(guardian)
- return false if !guardian.is_admin?
- return false if guardian.user.id != User.first_login_admin_id
- user_id = guardian.user.id
-
- show_welcome_topic_banner = Discourse.cache.read(welcome_topic_banner_cache_key(user_id))
- return show_welcome_topic_banner unless show_welcome_topic_banner.nil?
-
- show_welcome_topic_banner = welcome_topic_exists_and_is_not_edited?
-
- Discourse.cache.write(welcome_topic_banner_cache_key(user_id), show_welcome_topic_banner)
- show_welcome_topic_banner
- end
end
diff --git a/app/models/user.rb b/app/models/user.rb
index ae589ce8569..45f3b0c47fb 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -355,6 +355,7 @@ class User < ActiveRecord::Base
post_menu: 3,
topic_notification_levels: 4,
suggested_topics: 5,
+ welcome_topic: 6,
)
end
diff --git a/app/serializers/site_serializer.rb b/app/serializers/site_serializer.rb
index 6af8623a3f7..7bafdb66976 100644
--- a/app/serializers/site_serializer.rb
+++ b/app/serializers/site_serializer.rb
@@ -37,7 +37,6 @@ class SiteSerializer < ApplicationSerializer
:hashtag_configurations,
:hashtag_icons,
:displayed_about_plugin_stat_groups,
- :show_welcome_topic_banner,
:anonymous_default_sidebar_tags,
:anonymous_sidebar_sections,
:whispers_allowed_groups_names,
@@ -249,10 +248,6 @@ class SiteSerializer < ApplicationSerializer
About.displayed_plugin_stat_groups
end
- def show_welcome_topic_banner
- Site.show_welcome_topic_banner?(scope)
- end
-
def anonymous_default_sidebar_tags
SiteSetting.default_sidebar_tags.split("|") - DiscourseTagging.hidden_tag_names(scope)
end
diff --git a/config/initializers/014-track-setting-changes.rb b/config/initializers/014-track-setting-changes.rb
index 6fa3a40b613..498123a5475 100644
--- a/config/initializers/014-track-setting-changes.rb
+++ b/config/initializers/014-track-setting-changes.rb
@@ -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
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index bfb22501eea..103caac8c40 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -1930,6 +1930,10 @@ en:
title: "Keep reading!"
content: "Here are some topics we think you might like to read next."
+ welcome_topic:
+ title: "Edit the welcome topic"
+ content: "Help new members feel at home by customizing this topic to suit your community's needs."
+
loading: "Loading..."
errors:
prev_page: "while trying to load"
diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml
index 9b8219c7d36..e9f3b33b165 100644
--- a/config/locales/server.en.yml
+++ b/config/locales/server.en.yml
@@ -678,21 +678,19 @@ en:
staff_category_description: "Private category for staff discussions. Topics are only visible to admins and moderators."
discourse_welcome_topic:
- title: "Welcome to our community!"
+ title: "Welcome to %{site_title}! :wave:"
body: |
+ We're so glad you've joined us. %{site_description}
- The first paragraph of this pinned topic will be visible as a welcome message to all new visitors on your homepage. It's important!
+ %{site_title} is powered by Discourse.org, the powerful, open platform for communities of all kinds. Here are some things you can do to get started:
- **Edit this** into a brief description of your community:
+ :speaking_head: **Introduce yourself** by adding your picture and information about yourself and your interests to [your profile](%{base_path}/my/profile). What is one thing you’d like to be asked about?
- - Who is it for?
- - What can they find here?
- - Why should they come here?
- - Where can they read more (links, resources, etc)?
+ :open_book: **Get to know the community** by [browsing discussions](%{base_path}/top) that are already happening here. When you find a post interesting, informative, or entertaining, use the :heart: to show your appreciation or support!
-
+ :handshake: **Contribute** by commenting, sharing your own perspective, asking questions, or offering feedback in the discussion. Before replying or starting new topics, please review the [Community Guidelines](%{base_path}/faq).
- You may want to close this topic via the admin :wrench: (at the upper right and bottom), so that replies don't pile up on an announcement.
+ > If you need help or have a suggestion, feel free to ask in [#feedback](%{base_path}/c/site-feedback) or [contact the admins](%{base_path}/about).
admin_quick_start_title: "READ ME FIRST: Admin Quick Start Guide"
diff --git a/lib/post_revisor.rb b/lib/post_revisor.rb
index ca3c86bca60..7f9d55c1b60 100644
--- a/lib/post_revisor.rb
+++ b/lib/post_revisor.rb
@@ -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
diff --git a/lib/seed_data/topics.rb b/lib/seed_data/topics.rb
index d98106579d9..ad4d15052f0 100644
--- a/lib/seed_data/topics.rb
+++ b/lib/seed_data/topics.rb
@@ -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) },
}
diff --git a/lib/topic_query_params.rb b/lib/topic_query_params.rb
index 9e6d69395c2..4195c3709aa 100644
--- a/lib/topic_query_params.rb
+++ b/lib/topic_query_params.rb
@@ -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
diff --git a/public/images/welcome/discourse-edit-post-animated.gif b/public/images/welcome/discourse-edit-post-animated.gif
deleted file mode 100644
index 1600beea327..00000000000
Binary files a/public/images/welcome/discourse-edit-post-animated.gif and /dev/null differ
diff --git a/spec/lib/post_revisor_spec.rb b/spec/lib/post_revisor_spec.rb
index ec13f74f4bb..1696471dcda 100644
--- a/spec/lib/post_revisor_spec.rb
+++ b/spec/lib/post_revisor_spec.rb
@@ -879,26 +879,6 @@ RSpec.describe PostRevisor do
end
end
- describe "welcome topic" do
- before { SiteSetting.welcome_topic_id = topic.id }
-
- it "should publish welcome topic edit message" do
- revisor = PostRevisor.new(post)
- first_post = topic.first_post
- UserAuthToken.generate!(user_id: admin.id)
- Discourse.cache.write(Site.welcome_topic_banner_cache_key(admin.id), true)
-
- messages =
- MessageBus.track_publish("/site/welcome-topic-banner") do
- revisor.revise!(admin, { raw: "updated welcome topic body" })
- end
- welcome_topic_banner_message =
- messages.find { |message| message.channel == "/site/welcome-topic-banner" }
- expect(welcome_topic_banner_message).to be_present
- expect(welcome_topic_banner_message.data).to eq(false)
- end
- end
-
it "doesn't strip starting whitespaces" do
subject.revise!(post.user, raw: " <-- whitespaces --> ")
post.reload
diff --git a/spec/lib/seed_data/topics_spec.rb b/spec/lib/seed_data/topics_spec.rb
index 581ecc10273..815d30ac314 100644
--- a/spec/lib/seed_data/topics_spec.rb
+++ b/spec/lib/seed_data/topics_spec.rb
@@ -19,9 +19,16 @@ RSpec.describe SeedData::Topics do
expect { create_topic }.to change { Topic.count }.by(1).and change { Post.count }.by(1)
topic = Topic.last
- expect(topic.title).to eq(I18n.t("discourse_welcome_topic.title"))
+ expect(topic.title).to eq(
+ I18n.t("discourse_welcome_topic.title", site_title: SiteSetting.title),
+ )
expect(topic.first_post.raw).to eq(
- I18n.t("discourse_welcome_topic.body", base_path: Discourse.base_path).rstrip,
+ I18n.t(
+ "discourse_welcome_topic.body",
+ base_path: Discourse.base_path,
+ site_title: SiteSetting.title,
+ site_description: SiteSetting.site_description,
+ ).rstrip,
)
expect(topic.category_id).to eq(SiteSetting.general_category_id)
expect(topic.user_id).to eq(Discourse::SYSTEM_USER_ID)
@@ -81,9 +88,16 @@ RSpec.describe SeedData::Topics do
update_topic
topic.reload
- expect(topic.title).to eq(I18n.t("discourse_welcome_topic.title"))
+ expect(topic.title).to eq(
+ I18n.t("discourse_welcome_topic.title", site_title: SiteSetting.title),
+ )
expect(topic.first_post.raw).to eq(
- I18n.t("discourse_welcome_topic.body", base_path: Discourse.base_path).rstrip,
+ I18n.t(
+ "discourse_welcome_topic.body",
+ base_path: Discourse.base_path,
+ site_title: SiteSetting.title,
+ site_description: SiteSetting.site_description,
+ ).rstrip,
)
end
diff --git a/spec/lib/topics_filter_spec.rb b/spec/lib/topics_filter_spec.rb
index aa82ad25fcd..9bcb38953e5 100644
--- a/spec/lib/topics_filter_spec.rb
+++ b/spec/lib/topics_filter_spec.rb
@@ -1345,7 +1345,7 @@ RSpec.describe TopicsFilter do
.new(guardian: Guardian.new)
.filter_from_query_string("order:category")
.pluck(:id),
- ).to eq([topic2.id, topic.id, topic5.id, topic3.id, topic4.id])
+ ).to eq([topic2.id, [topic.id, topic5.id].sort, [topic3.id, topic4.id].sort].flatten)
end
end
end
diff --git a/spec/models/site_spec.rb b/spec/models/site_spec.rb
index a8d67af563f..385e0993faf 100644
--- a/spec/models/site_spec.rb
+++ b/spec/models/site_spec.rb
@@ -188,66 +188,4 @@ RSpec.describe Site do
data = JSON.parse(Site.json_for(Guardian.new))
expect(data["auth_providers"].map { |a| a["name"] }).to contain_exactly("facebook", "twitter")
end
-
- describe ".show_welcome_topic_banner?" do
- it "returns false when the user is not admin" do
- first_post = Fabricate(:post, created_at: 25.days.ago)
- SiteSetting.welcome_topic_id = first_post.topic.id
-
- expect(Site.show_welcome_topic_banner?(Guardian.new(Fabricate(:user)))).to eq(false)
- end
-
- it "returns false when the user is not first admin who logs in" do
- admin = Fabricate(:admin)
- first_post = Fabricate(:post, created_at: 25.days.ago)
- SiteSetting.welcome_topic_id = first_post.topic.id
-
- expect(Site.show_welcome_topic_banner?(Guardian.new(admin))).to eq(false)
- end
-
- it "returns true when welcome topic is less than month old" do
- admin = Fabricate(:admin)
- UserAuthToken.generate!(user_id: admin.id)
-
- first_post = Fabricate(:post, created_at: 25.days.ago)
- SiteSetting.welcome_topic_id = first_post.topic.id
-
- expect(Site.show_welcome_topic_banner?(Guardian.new(admin))).to eq(true)
- expect(Discourse.cache.read(Site.welcome_topic_banner_cache_key(admin.id))).to eq(true)
- end
-
- it "returns false when welcome topic is more than month old" do
- admin = Fabricate(:admin)
- UserAuthToken.generate!(user_id: admin.id)
-
- first_post = Fabricate(:post, created_at: 35.days.ago)
- SiteSetting.welcome_topic_id = first_post.topic.id
-
- expect(Site.show_welcome_topic_banner?(Guardian.new(admin))).to eq(false)
- expect(Discourse.cache.read(Site.welcome_topic_banner_cache_key(admin.id))).to eq(false)
- end
-
- it "returns false when welcome topic has been edited" do
- admin = Fabricate(:admin)
- UserAuthToken.generate!(user_id: admin.id)
-
- first_post = Fabricate(:post, version: 2, created_at: 25.days.ago)
- SiteSetting.welcome_topic_id = first_post.topic.id
-
- expect(Site.show_welcome_topic_banner?(Guardian.new(admin))).to eq(false)
- expect(Discourse.cache.read(Site.welcome_topic_banner_cache_key(admin.id))).to eq(false)
- end
-
- it "returns false when welcome topic has been deleted" do
- admin = Fabricate(:admin)
- UserAuthToken.generate!(user_id: admin.id)
-
- topic = Fabricate(:topic, deleted_at: 1.minute.ago)
- first_post = Fabricate(:post, topic: topic, created_at: 25.days.ago)
- SiteSetting.welcome_topic_id = topic.id
-
- expect(Site.show_welcome_topic_banner?(Guardian.new(admin))).to eq(false)
- expect(Discourse.cache.read(Site.welcome_topic_banner_cache_key(admin.id))).to eq(false)
- end
- end
end
diff --git a/spec/requests/api/schemas/json/site_response.json b/spec/requests/api/schemas/json/site_response.json
index 2830f20bfe3..3e215cc38f6 100644
--- a/spec/requests/api/schemas/json/site_response.json
+++ b/spec/requests/api/schemas/json/site_response.json
@@ -241,6 +241,9 @@
},
"suggested_topics": {
"type": "integer"
+ },
+ "welcome_topic": {
+ "type": "integer"
}
},
"required": [
@@ -752,9 +755,6 @@
]
}
},
- "show_welcome_topic_banner": {
- "type": "boolean"
- },
"archetypes": {
"type": "array",
"items":
diff --git a/spec/requests/categories_controller_spec.rb b/spec/requests/categories_controller_spec.rb
index 8eec0f2bcd4..8666391b98a 100644
--- a/spec/requests/categories_controller_spec.rb
+++ b/spec/requests/categories_controller_spec.rb
@@ -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)
diff --git a/spec/requests/list_controller_spec.rb b/spec/requests/list_controller_spec.rb
index da2eb313670..7a7682dc3ff 100644
--- a/spec/requests/list_controller_spec.rb
+++ b/spec/requests/list_controller_spec.rb
@@ -1078,57 +1078,6 @@ RSpec.describe ListController do
end
end
- describe "welcome topic" do
- fab!(:welcome_topic) { Fabricate(:topic) }
- fab!(:post) { Fabricate(:post, topic: welcome_topic) }
-
- before do
- 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 "/latest.json"
- expect(response.status).to eq(200)
- parsed = response.parsed_body
- expect(parsed["topic_list"]["topics"].length).to eq(1)
- expect(parsed["topic_list"]["topics"].first["id"]).not_to eq(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 "/latest.json"
- expect(response.status).to eq(200)
- parsed = response.parsed_body
- expect(parsed["topic_list"]["topics"].length).to eq(2)
- expect(parsed["topic_list"]["topics"].first["id"]).to eq(welcome_topic.id)
- end
-
- it "is hidden to admins" do
- sign_in(admin)
-
- get "/latest.json"
- expect(response.status).to eq(200)
- parsed = response.parsed_body
- expect(parsed["topic_list"]["topics"].length).to eq(1)
- expect(parsed["topic_list"]["topics"].first["id"]).not_to eq(welcome_topic.id)
- end
-
- it "is shown to users when bootstrap mode is disabled" do
- SiteSetting.bootstrap_mode_enabled = false
-
- get "/latest.json"
- expect(response.status).to eq(200)
- parsed = response.parsed_body
- expect(parsed["topic_list"]["topics"].length).to eq(2)
- expect(parsed["topic_list"]["topics"].first["id"]).to eq(welcome_topic.id)
- end
- end
-
describe "#filter" do
fab!(:category) { Fabricate(:category, slug: "category-slug") }
fab!(:tag) { Fabricate(:tag, name: "tag1") }
diff --git a/spec/serializers/site_serializer_spec.rb b/spec/serializers/site_serializer_spec.rb
index c3b0f7c988b..201b0fb325b 100644
--- a/spec/serializers/site_serializer_spec.rb
+++ b/spec/serializers/site_serializer_spec.rb
@@ -131,19 +131,6 @@ RSpec.describe SiteSerializer do
expect(serialized[:shared_drafts_category_id]).to eq(nil)
end
- it "includes show_welcome_topic_banner" do
- admin = Fabricate(:admin)
- admin_guardian = Guardian.new(admin)
- UserAuthToken.generate!(user_id: admin.id)
-
- first_post = Fabricate(:post, created_at: 25.days.ago)
- SiteSetting.welcome_topic_id = first_post.topic.id
-
- serialized =
- described_class.new(Site.new(admin_guardian), scope: admin_guardian, root: false).as_json
- expect(serialized[:show_welcome_topic_banner]).to eq(true)
- end
-
describe "#anonymous_default_sidebar_tags" do
fab!(:user) { Fabricate(:user) }
fab!(:tag) { Fabricate(:tag, name: "dev") }