[go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: show urgent badge for mentions in DM threads #29821

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

dbattersby
Copy link
Contributor
@dbattersby dbattersby commented Nov 19, 2024

When thread tracking level is Normal in a DM channel, we should still show notification badges to the mentioned user.

This change means that:

When a user is @ mentioned in a thread that they’ve set to Normal tracking:

  • DMs tab (mobile/desktop drawer) - show urgent badge with count
  • DM channel list (mobile/drawer) - show urgent badge with count next to channel name
  • Sidebar on desktop - show urgent badge next to channel name (without count)
  • Chat launcher - show urgent badge next to channel name (without count)
  • Chat Header icon - include mentions in DM channels as part of the urgent count
  • DM channel list (sorting) - use mentions from threads as part of sorting logic

I've included some additional changes that we are missing:

  • Chat launcher - show unread badge (blue dot) for new thread unreads for channels and users
  • Sidebar on desktop - show urgent badge (green dot) for watched threads unreads in DM channels

Mention within a DM thread (header):
Screenshot 2024-11-26 at 1 22 34 PM

Mention within a DM thread (channel list):
Screenshot 2024-11-26 at 1 22 24 PM

Mention within a DM thread (chat footer badge):
Screenshot 2024-11-26 at 1 22 14 PM

Mention within a DM thread (sidebar):
Screenshot 2024-11-26 at 1 20 13 PM

Mention within a DM thread (unread tracked thread):
Screenshot 2024-11-26 at 1 19 15 PM

@github-actions github-actions bot added the chat PRs which include a change to Chat plugin label Nov 19, 2024
@dbattersby dbattersby force-pushed the show-urgent-badge-for-mentions-in-dms branch from 03ca2bc to 5aa7170 Compare November 22, 2024 08:57
return this.chatTrackingStateManager.directMessageUnreadCount;
return (
this.chatTrackingStateManager.directMessageUnreadCount +
this.chatTrackingStateManager.directMessageMentionCount
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adds mention count to DMs tab on chat footer for mobile/drawer

Comment on lines +30 to +32
this.args.channel.tracking.unreadCount +
this.args.channel.tracking.mentionCount +
this.args.channel.tracking.watchedThreadsUnreadCount
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adds the mention count for DM threads to the channel list indicator on mobile/drawer

Comment on lines +433 to +437
return this.channel.tracking.unreadCount > 0 ||
this.channel.tracking.mentionCount > 0 ||
this.channel.tracking.watchedThreadsUnreadCount > 0
? "urgent"
: "unread";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adds DM mention count to the sidebar as part of the urgent badge.

@@ -424,7 +423,18 @@ export default {
}

get suffixValue() {
return this.channel.tracking.unreadCount > 0 ? "circle" : "";
return this.channel.tracking.unreadCount > 0 ||
this.channel.unreadThreadsCountSinceLastViewed > 0
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We now show thread state for DM channels in the sidebar.

@@ -76,7 +76,7 @@ export default class ChatTrackingStateManager extends Service {

get allChannelUrgentCount() {
return (
this.publicChannelMentionCount +
this.allChannelMentionCount +
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This allows us to show the urgent badge on the chat header icon when a user is mentioned within a thread in a DM channel.

Comment on lines +102 to +107
const { allChannels } = this.chatChannelsManager;
if (chatable.type === "user") {
return allChannels.find(
({ chatable: { users } }) =>
users?.length === 1 && users[0].id === chatable.model.id
);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since chatable type for 1-1 DMs is user when searching within message creator, we need to get the channel so that we can access tracking data.

Comment on lines +256 to +259
const aUrgent =
a.tracking.unreadCount +
a.tracking.mentionCount +
a.tracking.watchedThreadsUnreadCount;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adds mention count as part of the sorting logic for DM channels.

@dbattersby dbattersby marked this pull request as ready for review November 26, 2024 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chat PRs which include a change to Chat plugin
Development

Successfully merging this pull request may close these issues.

1 participant