Page MenuHomePhabricator

D6186.id20769.diff
No OneTemporary

D6186.id20769.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
@@ -27,7 +27,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';
@@ -388,7 +391,10 @@
}
const { generatesNotifs } = messageSpecs[type];
const doesGenerateNotif = await generatesNotifs(messageInfo, {
+ notifTargetUserID: userID,
userNotMemberOfSubthreads,
+ fetchMessageInfoByID: (messageID: string) =>
+ fetchMessageInfoByID(viewer, messageID),
});
return doesGenerateNotif ? messageInfo : undefined;
}),
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
@@ -68,7 +68,9 @@
};
export type GeneratesNotifsParams = {
+ +notifTargetUserID: string,
+userNotMemberOfSubthreads: Set<string>,
+ +fetchMessageInfoByID: (messageID: string) => Promise<?RawMessageInfo>,
};
export type MessageSpec<Data, RawInfo, Info> = {
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
@@ -26,6 +26,7 @@
MessageSpec,
MessageTitleParam,
NotificationTextsParams,
+ GeneratesNotifsParams,
} from './message-spec';
import { assertSingleMessageInfo, joinResult } from './utils';
@@ -208,5 +209,15 @@
);
},
- generatesNotifs: async () => true,
+ generatesNotifs: async (
+ rawMessageInfo: RawReactionMessageInfo,
+ params: GeneratesNotifsParams,
+ ) => {
+ const { notifTargetUserID, fetchMessageInfoByID } = params;
+ const targetMessageInfo = await fetchMessageInfoByID(
+ rawMessageInfo.targetMessageID,
+ );
+ console.log(targetMessageInfo);
+ return targetMessageInfo?.creatorID === notifTargetUserID;
+ },
});

File Metadata

Mime Type
text/plain
Expires
Fri, Dec 20, 4:18 PM (16 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2682039
Default Alt Text
D6186.id20769.diff (2 KB)

Event Timeline