A platform for community discussion. Free, open, simple.
DEV: Fix glimmer suggested topic item badges (#27123)
Jarek Radosz4b29ab8572f3
diff --git a/app/assets/javascripts/discourse/app/components/topic-list/list.gjs b/app/assets/javascripts/discourse/app/components/topic-list/list.gjsindex 69e595db553..0e038671966 100644--- a/app/assets/javascripts/discourse/app/components/topic-list/list.gjs+++ b/app/assets/javascripts/discourse/app/components/topic-list/list.gjs@@ -89,6 +89,10 @@ export default class TopicList extends Component {return lastVisitedTopic;}+ get showTopicPostBadges() {+ return this.args.showTopicPostBadges ?? true;+ }+<template>{{! template-lint-disable table-groups }}<table@@ -140,7 +144,7 @@ export default class TopicList extends Component {<TopicListItem@topic={{topic}}@bulkSelectEnabled={{this.bulkSelectEnabled}}- @showTopicPostBadges={{@showTopicPostBadges}}+ @showTopicPostBadges={{this.showTopicPostBadges}}@hideCategory={{@hideCategory}}@showPosters={{@showPosters}}@showLikes={{this.showLikes}}diff --git a/spec/system/topic_list/glimmer_spec.rb b/spec/system/topic_list/glimmer_spec.rbindex 09e056af88b..faab73cca7d 100644--- a/spec/system/topic_list/glimmer_spec.rb+++ b/spec/system/topic_list/glimmer_spec.rb@@ -2,9 +2,10 @@describe "glimmer topic list", type: :system dofab!(:user)+ fab!(:group) { Fabricate(:group, users: [user]) }before do- SiteSetting.experimental_glimmer_topic_list_groups = "1"+ SiteSetting.experimental_glimmer_topic_list_groups = group.namesign_in(user)end@@ -40,11 +41,29 @@ describe "glimmer topic list", type: :system dolet(:topic_page) { PageObjects::Pages::Topic.new }it "shows the list" do- topic = Fabricate(:post).topic+ topic1 = Fabricate(:post).topictopic2 = Fabricate(:post).topic- visit(topic.relative_url)++ new_reply =+ Fabricate(:post).topic.tap do |topic|+ TopicUser.change(+ user.id,+ topic.id,+ notification_level: TopicUser.notification_levels[:tracking],+ )+ TopicUser.update_last_read(user, topic.id, 1, 1, 1)+ Fabricate.times(3, :post, topic: topic)+ end++ visit(topic1.relative_url)expect(topic_page).to have_suggested_topic(topic2)+ expect(page).to have_css("[data-topic-id='#{topic2.id}'] a.badge-notification.new-topic")++ expect(topic_page).to have_suggested_topic(new_reply)+ expect(+ find("[data-topic-id='#{new_reply.id}'] a.badge-notification.unread-posts").text,+ ).to eq("3")endendend