Page MenuHomePhabricator

D13216.id43932.diff
No OneTemporary

D13216.id43932.diff

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

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)

Event Timeline