Page MenuHomePhabricator

D12655.diff
No OneTemporary

D12655.diff

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

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)

Event Timeline