DEV: Fix glimmer suggested topic item badges (#27123)
This commit is contained in:
parent
48b74245b9
commit
4b29ab8572
|
@ -89,6 +89,10 @@ export default class TopicList extends Component {
|
||||||
return lastVisitedTopic;
|
return lastVisitedTopic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get showTopicPostBadges() {
|
||||||
|
return this.args.showTopicPostBadges ?? true;
|
||||||
|
}
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
{{! template-lint-disable table-groups }}
|
{{! template-lint-disable table-groups }}
|
||||||
<table
|
<table
|
||||||
|
@ -140,7 +144,7 @@ export default class TopicList extends Component {
|
||||||
<TopicListItem
|
<TopicListItem
|
||||||
@topic={{topic}}
|
@topic={{topic}}
|
||||||
@bulkSelectEnabled={{this.bulkSelectEnabled}}
|
@bulkSelectEnabled={{this.bulkSelectEnabled}}
|
||||||
@showTopicPostBadges={{@showTopicPostBadges}}
|
@showTopicPostBadges={{this.showTopicPostBadges}}
|
||||||
@hideCategory={{@hideCategory}}
|
@hideCategory={{@hideCategory}}
|
||||||
@showPosters={{@showPosters}}
|
@showPosters={{@showPosters}}
|
||||||
@showLikes={{this.showLikes}}
|
@showLikes={{this.showLikes}}
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
|
|
||||||
describe "glimmer topic list", type: :system do
|
describe "glimmer topic list", type: :system do
|
||||||
fab!(:user)
|
fab!(:user)
|
||||||
|
fab!(:group) { Fabricate(:group, users: [user]) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
SiteSetting.experimental_glimmer_topic_list_groups = "1"
|
SiteSetting.experimental_glimmer_topic_list_groups = group.name
|
||||||
sign_in(user)
|
sign_in(user)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -40,11 +41,29 @@ describe "glimmer topic list", type: :system do
|
||||||
let(:topic_page) { PageObjects::Pages::Topic.new }
|
let(:topic_page) { PageObjects::Pages::Topic.new }
|
||||||
|
|
||||||
it "shows the list" do
|
it "shows the list" do
|
||||||
topic = Fabricate(:post).topic
|
topic1 = Fabricate(:post).topic
|
||||||
topic2 = 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(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
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue