FIX: Show replies count on thread indicator regardless of participants (#22459)

Followup to 802fb3b194

We should not hide the replies count if there is only 1 participant
for a thread, because this makes it look like the last reply is the
only reply.
This commit is contained in:
Martin Brennan 2023-07-06 14:31:18 +10:00 committed by GitHub
parent e1c3c7bddf
commit 9b14bf82dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 4 deletions

View File

@ -24,6 +24,9 @@
{{format-date @message.thread.preview.lastReplyCreatedAt leaveAgo="true"}}
</span>
</div>
<div class="chat-message-thread-indicator__replies-count">
{{i18n "chat.thread.replies" count=@message.thread.preview.replyCount}}
</div>
<Chat::Thread::Participants @thread={{@message.thread}} />
<div class="chat-message-thread-indicator__last-reply-excerpt">
{{replace-emoji (html-safe @message.thread.preview.lastReplyExcerpt)}}

View File

@ -1,7 +1,4 @@
{{#if (gt @thread.preview.participantUsers.length 1)}}
<div class="chat-message-thread-indicator__replies-count">
{{i18n "chat.thread.replies" count=@thread.preview.replyCount}}
</div>
<div class="chat-thread-participants">
<div class="chat-thread-participants__avatar-group">
{{#each @thread.preview.participantUsers as |user|}}

View File

@ -74,6 +74,20 @@ describe "Thread indicator for chat messages", type: :system do
)
end
it "it shows the reply count but no participant avatars when there is only one participant" do
single_user_thread =
Fabricate(:chat_thread, channel: channel, original_message_user: current_user)
Fabricate(:chat_message, thread: single_user_thread, user: current_user)
Fabricate(:chat_message, thread: single_user_thread, user: current_user)
chat_page.visit_channel(channel)
expect(
channel_page.message_thread_indicator(single_user_thread.original_message),
).to have_reply_count(2)
expect(
channel_page.message_thread_indicator(single_user_thread.original_message),
).to have_no_participants
end
it "clicking a thread indicator opens the thread panel" do
chat_page.visit_channel(channel)
channel_page.message_thread_indicator(thread_1.original_message).click
@ -116,7 +130,7 @@ describe "Thread indicator for chat messages", type: :system do
)
end
it "shows participants of the thread" do
it "shows avatars for the participants of the thread" do
chat_page.visit_channel(channel)
expect(channel_page.message_thread_indicator(thread_1.original_message)).to have_participant(
current_user,

View File

@ -37,6 +37,10 @@ module PageObjects
)
end
def has_no_participants?
find(@context).has_no_css?(".chat-thread-participants")
end
def excerpt
find(@context).find("#{SELECTOR}__last-reply-excerpt")
end