Page MenuHomePhabricator

D6223.diff
No OneTemporary

D6223.diff

diff --git a/keyserver/src/creators/message-creator.js b/keyserver/src/creators/message-creator.js
--- a/keyserver/src/creators/message-creator.js
+++ b/keyserver/src/creators/message-creator.js
@@ -378,12 +378,12 @@
for (const messageIndex of messageIndices) {
const messageInfo = messageInfos[messageIndex];
const { type } = messageInfo;
- if (
- (messageInfo.type !== messageTypes.CREATE_SUB_THREAD ||
- userNotMemberOfSubthreads.has(messageInfo.childThreadID)) &&
- messageSpecs[type].generatesNotifs &&
- messageInfo.creatorID !== userID
- ) {
+ if (messageInfo.creatorID === userID) {
+ // We never send a user notifs about their own activity
+ continue;
+ }
+ const { generatesNotifs } = messageSpecs[type];
+ if (generatesNotifs(messageInfo, { userNotMemberOfSubthreads })) {
userPushInfo.messageInfos.push(messageInfo);
}
}
diff --git a/lib/shared/messages/add-members-message-spec.js b/lib/shared/messages/add-members-message-spec.js
--- a/lib/shared/messages/add-members-message-spec.js
+++ b/lib/shared/messages/add-members-message-spec.js
@@ -177,7 +177,7 @@
);
},
- generatesNotifs: false,
+ generatesNotifs: () => false,
userIDs(rawMessageInfo: RawAddMembersMessageInfo): $ReadOnlyArray<string> {
return rawMessageInfo.addedUserIDs;
diff --git a/lib/shared/messages/change-role-message-spec.js b/lib/shared/messages/change-role-message-spec.js
--- a/lib/shared/messages/change-role-message-spec.js
+++ b/lib/shared/messages/change-role-message-spec.js
@@ -192,5 +192,5 @@
);
},
- generatesNotifs: true,
+ generatesNotifs: () => true,
});
diff --git a/lib/shared/messages/change-settings-message-spec.js b/lib/shared/messages/change-settings-message-spec.js
--- a/lib/shared/messages/change-settings-message-spec.js
+++ b/lib/shared/messages/change-settings-message-spec.js
@@ -190,5 +190,5 @@
);
},
- generatesNotifs: true,
+ generatesNotifs: () => true,
});
diff --git a/lib/shared/messages/create-entry-message-spec.js b/lib/shared/messages/create-entry-message-spec.js
--- a/lib/shared/messages/create-entry-message-spec.js
+++ b/lib/shared/messages/create-entry-message-spec.js
@@ -179,5 +179,5 @@
return joinResult(rawMessageInfo.creatorID, rawMessageInfo.entryID);
},
- generatesNotifs: true,
+ generatesNotifs: () => true,
});
diff --git a/lib/shared/messages/create-sidebar-message-spec.js b/lib/shared/messages/create-sidebar-message-spec.js
--- a/lib/shared/messages/create-sidebar-message-spec.js
+++ b/lib/shared/messages/create-sidebar-message-spec.js
@@ -236,7 +236,7 @@
};
},
- generatesNotifs: true,
+ generatesNotifs: () => true,
userIDs(rawMessageInfo: RawCreateSidebarMessageInfo): $ReadOnlyArray<string> {
return rawMessageInfo.initialThreadState.memberIDs;
diff --git a/lib/shared/messages/create-sub-thread-message-spec.js b/lib/shared/messages/create-sub-thread-message-spec.js
--- a/lib/shared/messages/create-sub-thread-message-spec.js
+++ b/lib/shared/messages/create-sub-thread-message-spec.js
@@ -27,6 +27,7 @@
MessageSpec,
MessageTitleParam,
NotificationTextsParams,
+ GeneratesNotifsParams,
} from './message-spec';
import { assertSingleMessageInfo } from './utils';
@@ -159,7 +160,13 @@
);
},
- generatesNotifs: true,
+ generatesNotifs: (
+ rawMessageInfo: RawCreateSubthreadMessageInfo,
+ params: GeneratesNotifsParams,
+ ) => {
+ const { userNotMemberOfSubthreads } = params;
+ return userNotMemberOfSubthreads.has(rawMessageInfo.childThreadID);
+ },
threadIDs(
rawMessageInfo: RawCreateSubthreadMessageInfo,
diff --git a/lib/shared/messages/create-thread-message-spec.js b/lib/shared/messages/create-thread-message-spec.js
--- a/lib/shared/messages/create-thread-message-spec.js
+++ b/lib/shared/messages/create-thread-message-spec.js
@@ -202,7 +202,7 @@
};
},
- generatesNotifs: true,
+ generatesNotifs: () => true,
userIDs(rawMessageInfo: RawCreateThreadMessageInfo): $ReadOnlyArray<string> {
return rawMessageInfo.initialThreadState.memberIDs;
diff --git a/lib/shared/messages/delete-entry-message-spec.js b/lib/shared/messages/delete-entry-message-spec.js
--- a/lib/shared/messages/delete-entry-message-spec.js
+++ b/lib/shared/messages/delete-entry-message-spec.js
@@ -153,5 +153,5 @@
};
},
- generatesNotifs: true,
+ generatesNotifs: () => true,
});
diff --git a/lib/shared/messages/edit-entry-message-spec.js b/lib/shared/messages/edit-entry-message-spec.js
--- a/lib/shared/messages/edit-entry-message-spec.js
+++ b/lib/shared/messages/edit-entry-message-spec.js
@@ -179,5 +179,5 @@
return joinResult(rawMessageInfo.creatorID, rawMessageInfo.entryID);
},
- generatesNotifs: true,
+ generatesNotifs: () => true,
});
diff --git a/lib/shared/messages/join-thread-message-spec.js b/lib/shared/messages/join-thread-message-spec.js
--- a/lib/shared/messages/join-thread-message-spec.js
+++ b/lib/shared/messages/join-thread-message-spec.js
@@ -134,5 +134,5 @@
return joinResult(rawMessageInfo.type, rawMessageInfo.threadID);
},
- generatesNotifs: false,
+ generatesNotifs: () => false,
});
diff --git a/lib/shared/messages/leave-thread-message-spec.js b/lib/shared/messages/leave-thread-message-spec.js
--- a/lib/shared/messages/leave-thread-message-spec.js
+++ b/lib/shared/messages/leave-thread-message-spec.js
@@ -134,5 +134,5 @@
return joinResult(rawMessageInfo.type, rawMessageInfo.threadID);
},
- generatesNotifs: false,
+ generatesNotifs: () => false,
});
diff --git a/lib/shared/messages/message-spec.js b/lib/shared/messages/message-spec.js
--- a/lib/shared/messages/message-spec.js
+++ b/lib/shared/messages/message-spec.js
@@ -67,6 +67,10 @@
) => NotifTexts,
};
+export type GeneratesNotifsParams = {
+ +userNotMemberOfSubthreads: Set<string>,
+};
+
export type MessageSpec<Data, RawInfo, Info> = {
+messageContentForServerDB?: (data: Data | RawInfo) => string,
+messageContentForClientDB?: (data: RawInfo) => string,
@@ -103,7 +107,10 @@
params: NotificationTextsParams,
) => NotifTexts,
+notificationCollapseKey?: (rawMessageInfo: RawInfo) => string,
- +generatesNotifs: boolean,
+ +generatesNotifs: (
+ rawMessageInfo: RawInfo,
+ params: GeneratesNotifsParams,
+ ) => boolean,
+userIDs?: (rawMessageInfo: RawInfo) => $ReadOnlyArray<string>,
+startsThread?: boolean,
+threadIDs?: (rawMessageInfo: RawInfo) => $ReadOnlyArray<string>,
diff --git a/lib/shared/messages/multimedia-message-spec.js b/lib/shared/messages/multimedia-message-spec.js
--- a/lib/shared/messages/multimedia-message-spec.js
+++ b/lib/shared/messages/multimedia-message-spec.js
@@ -318,7 +318,7 @@
);
},
- generatesNotifs: true,
+ generatesNotifs: () => true,
includedInRepliesCount: true,
});
diff --git a/lib/shared/messages/reaction-message-spec.js b/lib/shared/messages/reaction-message-spec.js
--- a/lib/shared/messages/reaction-message-spec.js
+++ b/lib/shared/messages/reaction-message-spec.js
@@ -208,5 +208,5 @@
);
},
- generatesNotifs: true,
+ generatesNotifs: () => true,
});
diff --git a/lib/shared/messages/remove-members-message-spec.js b/lib/shared/messages/remove-members-message-spec.js
--- a/lib/shared/messages/remove-members-message-spec.js
+++ b/lib/shared/messages/remove-members-message-spec.js
@@ -177,7 +177,7 @@
);
},
- generatesNotifs: false,
+ generatesNotifs: () => false,
userIDs(rawMessageInfo: RawRemoveMembersMessageInfo): $ReadOnlyArray<string> {
return rawMessageInfo.removedUserIDs;
diff --git a/lib/shared/messages/restore-entry-message-spec.js b/lib/shared/messages/restore-entry-message-spec.js
--- a/lib/shared/messages/restore-entry-message-spec.js
+++ b/lib/shared/messages/restore-entry-message-spec.js
@@ -153,5 +153,5 @@
};
},
- generatesNotifs: true,
+ generatesNotifs: () => true,
});
diff --git a/lib/shared/messages/sidebar-source-message-spec.js b/lib/shared/messages/sidebar-source-message-spec.js
--- a/lib/shared/messages/sidebar-source-message-spec.js
+++ b/lib/shared/messages/sidebar-source-message-spec.js
@@ -177,7 +177,7 @@
return params.notificationTexts([sourceMessageInfo], threadInfo);
},
- generatesNotifs: false,
+ generatesNotifs: () => false,
startsThread: true,
});
diff --git a/lib/shared/messages/text-message-spec.js b/lib/shared/messages/text-message-spec.js
--- a/lib/shared/messages/text-message-spec.js
+++ b/lib/shared/messages/text-message-spec.js
@@ -195,6 +195,6 @@
}
},
- generatesNotifs: true,
+ generatesNotifs: () => true,
includedInRepliesCount: true,
});
diff --git a/lib/shared/messages/unsupported-message-spec.js b/lib/shared/messages/unsupported-message-spec.js
--- a/lib/shared/messages/unsupported-message-spec.js
+++ b/lib/shared/messages/unsupported-message-spec.js
@@ -90,5 +90,5 @@
return `${creator} ${messageInfo.robotext}`;
},
- generatesNotifs: true,
+ generatesNotifs: () => true,
});
diff --git a/lib/shared/messages/update-relationship-message-spec.js b/lib/shared/messages/update-relationship-message-spec.js
--- a/lib/shared/messages/update-relationship-message-spec.js
+++ b/lib/shared/messages/update-relationship-message-spec.js
@@ -197,5 +197,5 @@
};
},
- generatesNotifs: true,
+ generatesNotifs: () => true,
});

File Metadata

Mime Type
text/plain
Expires
Mon, Dec 23, 12:33 AM (14 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2693039
Default Alt Text
D6223.diff (9 KB)

Event Timeline