Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
Rocket.Chat
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RocketChat
Rocket.Chat
Commits
c4b60064
Unverified
Commit
c4b60064
authored
5 months ago
by
Hugo Costa
Committed by
GitHub
5 months ago
Browse files
Options
Downloads
Patches
Plain Diff
regression: thread unread count (#33837)
parent
180a4469
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
apps/meteor/app/threads/server/functions.ts
+13
-7
13 additions, 7 deletions
apps/meteor/app/threads/server/functions.ts
with
13 additions
and
7 deletions
apps/meteor/app/threads/server/functions.ts
+
13
−
7
View file @
c4b60064
...
...
@@ -15,16 +15,23 @@ export async function reply({ tmid }: { tmid?: string }, message: IMessage, pare
const
{
rid
,
ts
,
u
}
=
message
;
const
[
highlightsUids
,
threadFollowers
,
{
toAll
,
toHere
,
mentionIds
}]
=
await
Promise
.
all
([
getUserIdsFromHighlights
(
rid
,
message
),
Messages
.
getThreadFollowsByThreadId
(
tmid
),
getMentions
(
message
),
]);
const
{
toAll
,
toHere
,
mentionIds
}
=
await
getMentions
(
message
);
const
addToReplies
=
[
...
new
Set
([...
followers
,
...
mentionIds
,
...(
parentMessage
.
replies
?.
length
?
[
u
.
_id
]
:
[
parentMessage
.
u
.
_id
,
u
.
_id
])]),
...
new
Set
([
...
followers
,
...
mentionIds
,
...(
Array
.
isArray
(
parentMessage
.
replies
)
&&
parentMessage
.
replies
.
length
?
[
u
.
_id
]
:
[
parentMessage
.
u
.
_id
,
u
.
_id
]),
]),
];
await
Messages
.
updateRepliesByThreadId
(
tmid
,
addToReplies
,
ts
);
const
[
highlightsUids
,
threadFollowers
]
=
await
Promise
.
all
([
getUserIdsFromHighlights
(
rid
,
message
),
Messages
.
getThreadFollowsByThreadId
(
tmid
),
]);
const
threadFollowersUids
=
threadFollowers
?.
filter
((
userId
)
=>
userId
!==
u
.
_id
&&
!
mentionIds
.
includes
(
userId
))
||
[];
// Notify everyone involved in the thread
...
...
@@ -34,7 +41,6 @@ export async function reply({ tmid }: { tmid?: string }, message: IMessage, pare
const
mentionedUsers
=
[...
new
Set
([...
mentionIds
,
...
highlightsUids
])];
const
promises
=
[
Messages
.
updateRepliesByThreadId
(
tmid
,
addToReplies
,
ts
),
ReadReceipts
.
setAsThreadById
(
tmid
),
Subscriptions
.
addUnreadThreadByRoomIdAndUserIds
(
rid
,
threadFollowersUids
,
tmid
,
notifyOptions
),
];
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment