Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3390926
D12655.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D12655.diff
View Options
diff --git a/lib/shared/dm-ops/send-text-message-spec.js b/lib/shared/dm-ops/send-text-message-spec.js
--- a/lib/shared/dm-ops/send-text-message-spec.js
+++ b/lib/shared/dm-ops/send-text-message-spec.js
@@ -1,14 +1,40 @@
// @flow
+import uuid from 'uuid';
+
import type { DMOperationSpec } from './dm-op-spec.js';
import type { DMSendTextMessageOperation } from '../../types/dm-ops.js';
+import { messageTypes } from '../../types/message-types-enum.js';
+import { updateTypes } from '../../types/update-types-enum.js';
+import type { ClientUpdateInfo } from '../../types/update-types.js';
export const sendTextMessageSpec: DMOperationSpec<DMSendTextMessageOperation> =
Object.freeze({
- processDMOperation: async () => {
+ processDMOperation: async (
+ dmOperation: DMSendTextMessageOperation,
+ viewerID: string,
+ ) => {
+ const { threadID, creatorID, time, text } = dmOperation;
+ const textMessage = {
+ type: messageTypes.TEXT,
+ threadID,
+ creatorID,
+ time,
+ text,
+ };
+ const updateInfos: Array<ClientUpdateInfo> = [];
+ if (creatorID !== viewerID) {
+ updateInfos.push({
+ type: updateTypes.UPDATE_THREAD_READ_STATUS,
+ id: uuid.v4(),
+ time,
+ threadID,
+ unread: true,
+ });
+ }
return {
- rawMessageInfos: [],
- updateInfos: [],
+ rawMessageInfos: [textMessage],
+ updateInfos,
};
},
});
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 1, 1:33 AM (21 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2603179
Default Alt Text
D12655.diff (1 KB)
Attached To
Mode
D12655: [lib] DMOperationSpec for SEND_TEXT_MESSAGE operation
Attached
Detach File
Event Timeline
Log In to Comment