DEV: Fix glimmer suggested topic item badges (#27123)

This commit is contained in:
Jarek Radosz 2024-05-22 03:06:45 +02:00 committed by GitHub
parent 48b74245b9
commit 4b29ab8572
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 27 additions and 4 deletions

View File

@ -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}}

View File

@ -2,9 +2,10 @@
describe "glimmer topic list", type: :system do
fab!(:user)
fab!(:group) { Fabricate(:group, users: [user]) }
before do
SiteSetting.experimental_glimmer_topic_list_groups = "1"
SiteSetting.experimental_glimmer_topic_list_groups = group.name
sign_in(user)
end
@ -40,11 +41,29 @@ describe "glimmer topic list", type: :system do
let(:topic_page) { PageObjects::Pages::Topic.new }
it "shows the list" do
topic = Fabricate(:post).topic
topic1 = Fabricate(:post).topic
topic2 = 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")
end
end
end