Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3341683
D13216.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D13216.diff
View Options
diff --git a/lib/shared/dm-ops/add-members-spec.js b/lib/shared/dm-ops/add-members-spec.js
--- a/lib/shared/dm-ops/add-members-spec.js
+++ b/lib/shared/dm-ops/add-members-spec.js
@@ -76,9 +76,31 @@
currentThreadInfo.id,
defaultRoleID,
);
- const newMembers = addedUserIDs
- .filter(userID => !userIsMember(currentThreadInfo, userID))
- .map(userID =>
+
+ const memberTimestamps = { ...currentThreadInfo.timestamps.members };
+ const newMembers = [];
+ for (const userID of addedUserIDs) {
+ if (!memberTimestamps[userID]) {
+ memberTimestamps[userID] = {
+ isMember: time,
+ subscription: currentThreadInfo.creationTime,
+ };
+ }
+
+ if (memberTimestamps[userID].isMember > time) {
+ continue;
+ }
+
+ memberTimestamps[userID] = {
+ ...memberTimestamps[userID],
+ isMember: time,
+ };
+
+ if (userIsMember(currentThreadInfo, userID)) {
+ continue;
+ }
+
+ newMembers.push(
minimallyEncodeMemberInfo<ThickMemberInfo>({
id: userID,
role: defaultRoleID,
@@ -87,10 +109,15 @@
subscription: joinThreadSubscription,
}),
);
+ }
const resultThreadInfo = {
...currentThreadInfo,
members: [...currentThreadInfo.members, ...newMembers],
+ timestamps: {
+ ...currentThreadInfo.timestamps,
+ members: memberTimestamps,
+ },
};
const updateInfos = [
{
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 22, 11:26 PM (17 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2566525
Default Alt Text
D13216.diff (1 KB)
Attached To
Mode
D13216: [lib] Check the timestamps when adding thread members
Attached
Detach File
Event Timeline
Log In to Comment