Page MenuHomePhabricator

D6962.diff
No OneTemporary

D6962.diff

diff --git a/keyserver/src/creators/thread-creator.js b/keyserver/src/creators/thread-creator.js
--- a/keyserver/src/creators/thread-creator.js
+++ b/keyserver/src/creators/thread-creator.js
@@ -192,7 +192,11 @@
validateMembers: { initialMemberIDs, ghostMemberIDs },
} = await promiseAll(checkPromises);
- if (sourceMessage && sourceMessage.type === messageTypes.REACTION) {
+ if (
+ sourceMessage &&
+ (sourceMessage.type === messageTypes.REACTION ||
+ sourceMessage.type === messageTypes.EDIT_MESSAGE)
+ ) {
throw new ServerError('invalid_parameters');
}
diff --git a/keyserver/src/fetchers/message-fetchers.js b/keyserver/src/fetchers/message-fetchers.js
--- a/keyserver/src/fetchers/message-fetchers.js
+++ b/keyserver/src/fetchers/message-fetchers.js
@@ -689,8 +689,9 @@
if (rawMessageInfo.id) {
invariant(
rawMessageInfo.type !== messageTypes.SIDEBAR_SOURCE &&
- rawMessageInfo.type !== messageTypes.REACTION,
- 'SIDEBAR_SOURCE should not point to a SIDEBAR_SOURCE or REACTION',
+ rawMessageInfo.type !== messageTypes.REACTION &&
+ rawMessageInfo.type !== messageTypes.EDIT_MESSAGE,
+ 'SIDEBAR_SOURCE should not point to a SIDEBAR_SOURCE, REACTION or EDIT_MESSAGE',
);
messagesByID.set(rawMessageInfo.id, rawMessageInfo);
}
diff --git a/lib/selectors/chat-selectors.js b/lib/selectors/chat-selectors.js
--- a/lib/selectors/chat-selectors.js
+++ b/lib/selectors/chat-selectors.js
@@ -372,7 +372,10 @@
for (let i = messages.length - 1; i >= 0; i--) {
const messageInfo = messages[i];
- if (messageInfo.type === messageTypes.REACTION) {
+ if (
+ messageInfo.type === messageTypes.REACTION ||
+ messageInfo.type === messageTypes.EDIT_MESSAGE
+ ) {
continue;
}
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
@@ -28,6 +28,10 @@
type RawComposableMessageInfo,
type ThreadMessageInfo,
} from '../types/message-types.js';
+import type {
+ EditMessageInfo,
+ RawEditMessageInfo,
+} from '../types/messages/edit.js';
import type { ImagesMessageData } from '../types/messages/images.js';
import type { MediaMessageData } from '../types/messages/media.js';
import type {
@@ -313,7 +317,10 @@
}
function stripLocalID(
- rawMessageInfo: RawComposableMessageInfo | RawReactionMessageInfo,
+ rawMessageInfo:
+ | RawComposableMessageInfo
+ | RawReactionMessageInfo
+ | RawEditMessageInfo,
) {
const { localID, ...rest } = rawMessageInfo;
return rest;
@@ -367,7 +374,8 @@
messageInfo:
| ComposableMessageInfo
| RobotextMessageInfo
- | ReactionMessageInfo,
+ | ReactionMessageInfo
+ | EditMessageInfo,
threadInfo: ThreadInfo,
markdownRules: ParserRules,
): EntityText {
@@ -380,7 +388,8 @@
messageInfo.type !== messageTypes.TEXT &&
messageInfo.type !== messageTypes.IMAGES &&
messageInfo.type !== messageTypes.MULTIMEDIA &&
- messageInfo.type !== messageTypes.REACTION,
+ messageInfo.type !== messageTypes.REACTION &&
+ messageInfo.type !== messageTypes.EDIT_MESSAGE,
'messageTitle can only be auto-generated for RobotextMessageInfo',
);
return robotextForMessageInfo(messageInfo, threadInfo);
diff --git a/lib/shared/messages/sidebar-source-message-spec.js b/lib/shared/messages/sidebar-source-message-spec.js
--- a/lib/shared/messages/sidebar-source-message-spec.js
+++ b/lib/shared/messages/sidebar-source-message-spec.js
@@ -108,8 +108,9 @@
invariant(
sourceMessage &&
sourceMessage.type !== messageTypes.SIDEBAR_SOURCE &&
- sourceMessage.type !== messageTypes.REACTION,
- 'Sidebars can not be created from SIDEBAR SOURCE OR REACTION',
+ sourceMessage.type !== messageTypes.REACTION &&
+ sourceMessage.type !== messageTypes.EDIT_MESSAGE,
+ 'Sidebars can not be created from SIDEBAR SOURCE, REACTION or EDIT MESSAGE',
);
return {
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
@@ -48,6 +48,11 @@
EditEntryMessageInfo,
RawEditEntryMessageInfo,
} from './messages/edit-entry.js';
+import type {
+ RawEditMessageInfo,
+ EditMessageData,
+ EditMessageInfo,
+} from './messages/edit.js';
import type {
ImagesMessageData,
ImagesMessageInfo,
@@ -131,6 +136,7 @@
// Appears in the newly created sidebar
CREATE_SIDEBAR: 18,
REACTION: 19,
+ EDIT_MESSAGE: 20,
});
export type MessageType = $Values<typeof messageTypes>;
export function assertMessageType(ourMessageType: number): MessageType {
@@ -154,7 +160,8 @@
ourMessageType === 16 ||
ourMessageType === 17 ||
ourMessageType === 18 ||
- ourMessageType === 19,
+ ourMessageType === 19 ||
+ ourMessageType === 20,
'number is not MessageType enum',
);
return ourMessageType;
@@ -245,7 +252,8 @@
| UpdateRelationshipMessageData
| SidebarSourceMessageData
| CreateSidebarMessageData
- | ReactionMessageData;
+ | ReactionMessageData
+ | EditMessageData;
export type MultimediaMessageData = ImagesMessageData | MediaMessageData;
@@ -281,7 +289,8 @@
| RawComposableMessageInfo
| RawRobotextMessageInfo
| RawSidebarSourceMessageInfo
- | RawReactionMessageInfo;
+ | RawReactionMessageInfo
+ | RawEditMessageInfo;
export type LocallyComposedMessageInfo =
| ({
@@ -338,7 +347,8 @@
| ComposableMessageInfo
| RobotextMessageInfo
| SidebarSourceMessageInfo
- | ReactionMessageInfo;
+ | ReactionMessageInfo
+ | EditMessageInfo;
export type ThreadMessageInfo = {
messageIDs: string[],

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 24, 12:18 PM (17 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2699966
Default Alt Text
D6962.diff (5 KB)

Event Timeline