Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3366352
D13216.id43932.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.id43932.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
Tue, Nov 26, 11:01 AM (20 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2584349
Default Alt Text
D13216.id43932.diff (1 KB)
Attached To
Mode
D13216: [lib] Check the timestamps when adding thread members
Attached
Detach File
Event Timeline
Log In to Comment