Page MenuHomePhabricator

D13216.diff
No OneTemporary

D13216.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
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)

Event Timeline