Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3496961
D6186.id20745.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D6186.id20745.diff
View Options
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
@@ -26,7 +26,10 @@
appendSQLArray,
mergeOrConditions,
} from '../database/database';
-import { fetchMessageInfoForLocalID } from '../fetchers/message-fetchers';
+import {
+ fetchMessageInfoForLocalID,
+ fetchMessageInfoByID,
+} from '../fetchers/message-fetchers';
import { fetchOtherSessionsForViewer } from '../fetchers/session-fetchers';
import { fetchServerThreadInfos } from '../fetchers/thread-fetchers';
import { sendPushNotifs } from '../push/send';
@@ -365,6 +368,8 @@
const pushInfo = {};
const messageInfosPerUser = {};
const latestMessagesPerUser: LatestMessagesPerUser = new Map();
+ let fetchTargetMessageInfoPromise: Promise<?RawMessageInfo>;
+
for (const pair of perUserInfo) {
const [userID, preUserPushInfo] = pair;
const { subthreadsCanNotify } = preUserPushInfo;
@@ -378,6 +383,12 @@
invariant(messageIndices, `indices should exist for thread ${threadID}`);
for (const messageIndex of messageIndices) {
const messageInfo = messageInfos[messageIndex];
+ if (messageInfo.type === messageTypes.REACTION) {
+ fetchTargetMessageInfoPromise = fetchMessageInfoByID(
+ viewer,
+ messageInfo.targetMessageID,
+ );
+ }
if (
(messageInfo.type !== messageTypes.CREATE_SUB_THREAD ||
subthreadsCanNotify.has(messageInfo.childThreadID)) &&
@@ -388,12 +399,6 @@
}
}
}
- if (
- userPushInfo.devices.length > 0 &&
- userPushInfo.messageInfos.length > 0
- ) {
- pushInfo[userID] = userPushInfo;
- }
const userMessageInfos = [];
for (const threadID of preUserPushInfo.threadIDs) {
const messageIndices = threadsToMessageIndices.get(threadID);
@@ -416,6 +421,23 @@
messageInfos,
),
);
+
+ if (
+ userPushInfo.devices.length === 0 ||
+ userPushInfo.messageInfos.length === 0
+ ) {
+ continue;
+ }
+
+ if (fetchTargetMessageInfoPromise) {
+ const targetMessageInfo = await fetchTargetMessageInfoPromise;
+ const targetMessageCreatorID = targetMessageInfo?.creatorID;
+ if (targetMessageCreatorID && targetMessageCreatorID !== userID) {
+ continue;
+ }
+ }
+
+ pushInfo[userID] = userPushInfo;
}
const latestMessages = flattenLatestMessagesPerUser(latestMessagesPerUser);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 20, 4:35 PM (18 h, 41 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2682085
Default Alt Text
D6186.id20745.diff (2 KB)
Attached To
Mode
D6186: [keyserver] reaction messages only notifiy author of target message
Attached
Detach File
Event Timeline
Log In to Comment