A platform for community discussion. Free, open, simple.
FIX: chat channel row indicator should only show urgent count (#25458)
David Battersbye94446816273
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-channel-unread-indicator.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-channel-unread-indicator.gjsindex 55e331cca17..e1a77fe136d 100644--- a/plugins/chat/assets/javascripts/discourse/components/chat-channel-unread-indicator.gjs+++ b/plugins/chat/assets/javascripts/discourse/components/chat-channel-unread-indicator.gjs@@ -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}}diff --git a/plugins/chat/spec/system/message_notifications_mobile_spec.rb b/plugins/chat/spec/system/message_notifications_mobile_spec.rbindex 483c2b868f4..d0cd9f2880a 100644--- a/plugins/chat/spec/system/message_notifications_mobile_spec.rb+++ b/plugins/chat/spec/system/message_notifications_mobile_spec.rb@@ -104,6 +104,26 @@ RSpec.describe "Message notifications - mobile", type: :system, mobile: true doexpect(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)+ endendendend