mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 13:43:16 +08:00
FIX: chat channel row indicator should only show urgent count (#25458)
Correctly shows the number of urgent notifications in channel list, rather than showing all new notifications as urgent.
This commit is contained in:
parent
a695d85cbd
commit
e944468162
|
@ -19,7 +19,7 @@ export default class ChatChannelUnreadIndicator extends Component {
|
|||
}
|
||||
|
||||
get unreadCount() {
|
||||
if (this.#onlyMentions() && this.#hasChannelMentions()) {
|
||||
if (this.#hasChannelMentions()) {
|
||||
return this.args.channel.tracking.mentionCount;
|
||||
}
|
||||
return this.args.channel.tracking.unreadCount;
|
||||
|
@ -34,13 +34,6 @@ export default class ChatChannelUnreadIndicator extends Component {
|
|||
);
|
||||
}
|
||||
|
||||
get showUnreadCount() {
|
||||
if (this.#onlyMentions()) {
|
||||
return this.#hasChannelMentions();
|
||||
}
|
||||
return this.args.channel.isDirectMessageChannel || this.isUrgent;
|
||||
}
|
||||
|
||||
#hasChannelMentions() {
|
||||
return this.args.channel.tracking.mentionCount > 0;
|
||||
}
|
||||
|
@ -58,7 +51,7 @@ export default class ChatChannelUnreadIndicator extends Component {
|
|||
}}
|
||||
>
|
||||
<div class="chat-channel-unread-indicator__number">{{#if
|
||||
this.showUnreadCount
|
||||
this.isUrgent
|
||||
}}{{this.unreadCount}}{{else}} {{/if}}</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
|
|
@ -104,6 +104,26 @@ RSpec.describe "Message notifications - mobile", type: :system, mobile: true do
|
|||
expect(page).to have_css(".chat-header-icon .chat-channel-unread-indicator")
|
||||
expect(channel_index_page).to have_unread_channel(channel_1, count: 1)
|
||||
end
|
||||
|
||||
it "shows correct count when there are multiple messages but only 1 is urgent" do
|
||||
Jobs.run_immediately!
|
||||
|
||||
visit("/chat/channels")
|
||||
|
||||
create_message(
|
||||
channel_1,
|
||||
user: user_1,
|
||||
text: "Are you busy @#{current_user.username}?",
|
||||
)
|
||||
|
||||
3.times { create_message(channel_1, user: user_1) }
|
||||
|
||||
expect(page).to have_css(
|
||||
".chat-header-icon .chat-channel-unread-indicator",
|
||||
text: "1",
|
||||
)
|
||||
expect(channel_index_page).to have_unread_channel(channel_1, count: 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user