Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3517997
D13391.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D13391.diff
View Options
diff --git a/lib/shared/dm-ops/create-sidebar-spec.js b/lib/shared/dm-ops/create-sidebar-spec.js
--- a/lib/shared/dm-ops/create-sidebar-spec.js
+++ b/lib/shared/dm-ops/create-sidebar-spec.js
@@ -84,6 +84,7 @@
Object.freeze({
notificationsCreationData: async (
dmOperation: DMCreateSidebarOperation,
+ viewerID: string,
utilities: ProcessDMOperationUtilities,
) => {
const { sidebarSourceMessageData, createSidebarMessageData } =
diff --git a/lib/shared/dm-ops/dm-op-spec.js b/lib/shared/dm-ops/dm-op-spec.js
--- a/lib/shared/dm-ops/dm-op-spec.js
+++ b/lib/shared/dm-ops/dm-op-spec.js
@@ -32,6 +32,7 @@
export type DMOperationSpec<DMOp: DMOperation> = {
+notificationsCreationData?: (
dmOp: DMOp,
+ viewerID: string,
utilities: ProcessDMOperationUtilities,
) => Promise<NotificationsCreationData>,
+processDMOperation: (
diff --git a/lib/shared/dm-ops/process-dm-ops.js b/lib/shared/dm-ops/process-dm-ops.js
--- a/lib/shared/dm-ops/process-dm-ops.js
+++ b/lib/shared/dm-ops/process-dm-ops.js
@@ -128,7 +128,7 @@
) {
const notificationsCreationData = await dmOpSpecs[
dmOp.type
- ].notificationsCreationData?.(dmOp, utilities);
+ ].notificationsCreationData?.(dmOp, viewerID, utilities);
dispatchWithMetadata(
{
@@ -203,7 +203,11 @@
const dmOpSpec = dmOpSpecs[dmOp.type];
const notificationsCreationDataPromise = (async () => {
- return await dmOpSpec.notificationsCreationData?.(dmOp, utilities);
+ return await dmOpSpec.notificationsCreationData?.(
+ dmOp,
+ viewerID,
+ utilities,
+ );
})();
const [{ rawMessageInfos, updateInfos }, notificationsCreationData] =
@@ -360,6 +364,8 @@
const threadInfos = useSelector(state => state.threadStore.threadInfos);
const { getDMOpsSendingPromise } = usePeerToPeerCommunication();
const dispatchWithMetadata = useDispatchWithMetadata();
+ const loggedInUserInfo = useLoggedInUserInfo();
+ const viewerID = loggedInUserInfo?.id;
const allPeerUserIDAndDeviceIDs = useSelector(getAllPeerUserIDAndDeviceIDs);
const currentUserInfo = useSelector(state => state.currentUserInfo);
const utilities = useSendDMOperationUtils();
@@ -370,6 +376,14 @@
async (
dmOperationSpecification: OutboundComposableDMOperationSpecification,
): Promise<ProcessOutboundP2PMessagesResult> => {
+ if (!viewerID) {
+ console.log('ignored DMOperation because logged out');
+ return {
+ result: 'failure',
+ failedMessageIDs: [],
+ };
+ }
+
const { promise, dmOpID } = getDMOpsSendingPromise();
const { op, composableMessageID, recipients } = dmOperationSpecification;
@@ -405,7 +419,7 @@
const notificationsCreationData = await dmOpSpecs[
op.type
- ].notificationsCreationData?.(op, utilities);
+ ].notificationsCreationData?.(op, viewerID, utilities);
dispatchWithMetadata(
{
@@ -436,6 +450,7 @@
}
},
[
+ viewerID,
allPeerUserIDAndDeviceIDs,
currentUserInfo,
dispatchWithMetadata,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 23, 6:52 PM (18 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2695870
Default Alt Text
D13391.diff (3 KB)
Attached To
Mode
D13391: [lib] Add viewerID to DMOperationSpec.notificationsCreationData
Attached
Detach File
Event Timeline
Log In to Comment