Page MenuHomePhorge

D6117.1768814056.diff
No OneTemporary

Size
2 KB
Referenced Files
None
Subscribers
None

D6117.1768814056.diff

diff --git a/lib/shared/message-utils.js b/lib/shared/message-utils.js
--- a/lib/shared/message-utils.js
+++ b/lib/shared/message-utils.js
@@ -25,7 +25,10 @@
} from '../types/message-types';
import type { ImagesMessageData } from '../types/messages/images';
import type { MediaMessageData } from '../types/messages/media';
-import type { ReactionMessageInfo } from '../types/messages/reaction';
+import type {
+ RawReactionMessageInfo,
+ ReactionMessageInfo,
+} from '../types/messages/reaction';
import { type ThreadInfo } from '../types/thread-types';
import type { RelativeUserInfo, UserInfos } from '../types/user-types';
import { codeBlockRegex, type ParserRules } from './markdown';
@@ -359,7 +362,9 @@
return result;
}
-function stripLocalID(rawMessageInfo: RawComposableMessageInfo) {
+function stripLocalID(
+ rawMessageInfo: RawComposableMessageInfo | RawReactionMessageInfo,
+) {
const { localID, ...rest } = rawMessageInfo;
return rest;
}
diff --git a/lib/types/message-types.js b/lib/types/message-types.js
--- a/lib/types/message-types.js
+++ b/lib/types/message-types.js
@@ -192,7 +192,8 @@
if (
messageData.type !== messageTypes.TEXT &&
messageData.type !== messageTypes.IMAGES &&
- messageData.type !== messageTypes.MULTIMEDIA
+ messageData.type !== messageTypes.MULTIMEDIA &&
+ messageData.type !== messageTypes.REACTION
) {
return null;
}
@@ -294,7 +295,11 @@
| ({
...RawTextMessageInfo,
+localID: string,
- } & RawTextMessageInfo);
+ } & RawTextMessageInfo)
+ | ({
+ ...RawReactionMessageInfo,
+ +localID: string,
+ } & RawReactionMessageInfo);
export type MultimediaMessageInfo = ImagesMessageInfo | MediaMessageInfo;
export type ComposableMessageInfo = TextMessageInfo | MultimediaMessageInfo;
@@ -551,6 +556,7 @@
export type SendReactionMessageRequest = {
+threadID: string,
+ +localID?: string,
+targetMessageID: string,
+reaction: string,
+action: 'add_reaction' | 'remove_reaction',
diff --git a/lib/types/messages/reaction.js b/lib/types/messages/reaction.js
--- a/lib/types/messages/reaction.js
+++ b/lib/types/messages/reaction.js
@@ -4,6 +4,7 @@
export type ReactionMessageData = {
+type: 19,
+ +localID?: string, // for optimistic creations. included by new clients
+threadID: string,
+creatorID: string,
+time: number,
@@ -14,12 +15,13 @@
export type RawReactionMessageInfo = {
...ReactionMessageData,
- id: string,
+ id?: string, // null if local copy without ID yet
};
export type ReactionMessageInfo = {
+type: 19,
- +id: string,
+ +id?: string, // null if local copy without ID yet
+ +localID?: string, // for optimistic creations
+threadID: string,
+creator: RelativeUserInfo,
+time: number,

File Metadata

Mime Type
text/plain
Expires
Mon, Jan 19, 9:14 AM (11 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5955580
Default Alt Text
D6117.1768814056.diff (2 KB)

Event Timeline