Page MenuHomePhabricator

D6799.id22836.diff
No OneTemporary

D6799.id22836.diff

diff --git a/keyserver/src/responders/message-responders.js b/keyserver/src/responders/message-responders.js
--- a/keyserver/src/responders/message-responders.js
+++ b/keyserver/src/responders/message-responders.js
@@ -55,6 +55,7 @@
threadID: t.String,
localID: t.maybe(t.String),
text: t.String,
+ sidebarCreation: t.maybe(t.Boolean),
});
async function textMessageCreationResponder(
viewer: Viewer,
@@ -63,7 +64,7 @@
const request: SendTextMessageRequest = input;
await validateInput(viewer, sendTextMessageRequestInputValidator, request);
- const { threadID, localID, text: rawText } = request;
+ const { threadID, localID, text: rawText, sidebarCreation } = request;
const text = trimMessage(rawText);
if (!text) {
throw new ServerError('invalid_parameters');
@@ -88,6 +89,9 @@
if (localID) {
messageData = { ...messageData, localID };
}
+ if (sidebarCreation) {
+ messageData = { ...messageData, sidebarCreation };
+ }
const rawMessageInfos = await createMessages(viewer, [messageData]);
return { newMessageInfo: rawMessageInfos[0] };
@@ -115,11 +119,13 @@
tShape({
threadID: t.String,
localID: t.String,
+ sidebarCreation: t.maybe(t.Boolean),
mediaIDs: t.list(t.String),
}),
tShape({
threadID: t.String,
localID: t.String,
+ sidebarCreation: t.maybe(t.Boolean),
mediaMessageContents: t.list(tMediaMessageMedia),
}),
]);
@@ -141,7 +147,7 @@
throw new ServerError('invalid_parameters');
}
- const { threadID, localID } = request;
+ const { threadID, localID, sidebarCreation } = request;
const hasPermission = await checkThreadPermission(
viewer,
threadID,
@@ -173,6 +179,7 @@
threadID,
creatorID: viewer.id,
media,
+ sidebarCreation,
});
const [newMessageInfo] = await createMessages(viewer, [messageData]);
const { id } = newMessageInfo;
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
@@ -230,14 +230,15 @@
});
}
-type MediaMessageDataCreationInput = $ReadOnly<{
- threadID: string,
- creatorID: string,
- media: $ReadOnlyArray<Media>,
- localID?: ?string,
- time?: ?number,
+type MediaMessageDataCreationInput = {
+ +threadID: string,
+ +creatorID: string,
+ +media: $ReadOnlyArray<Media>,
+ +localID?: ?string,
+ +time?: ?number,
+ +sidebarCreation?: ?boolean,
...
-}>;
+};
function createMediaMessageData(
input: MediaMessageDataCreationInput,
): MultimediaMessageData {
@@ -252,7 +253,7 @@
}
}
- const { localID, threadID, creatorID } = input;
+ const { localID, threadID, creatorID, sidebarCreation } = input;
const time = input.time ? input.time : Date.now();
let messageData;
if (allMediaArePhotos) {
@@ -266,6 +267,9 @@
if (localID) {
messageData = { ...messageData, localID };
}
+ if (sidebarCreation) {
+ messageData = { ...messageData, sidebarCreation };
+ }
} else {
messageData = ({
type: messageTypes.MULTIMEDIA,
@@ -277,14 +281,17 @@
if (localID) {
messageData = { ...messageData, localID };
}
+ if (sidebarCreation) {
+ messageData = { ...messageData, sidebarCreation };
+ }
}
return messageData;
}
-type MediaMessageInfoCreationInput = $ReadOnly<{
+type MediaMessageInfoCreationInput = {
...$Exact<MediaMessageDataCreationInput>,
- id?: ?string,
-}>;
+ +id?: ?string,
+};
function createMediaMessageInfo(
input: MediaMessageInfoCreationInput,
): RawMultimediaMessageInfo {
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
@@ -529,16 +529,19 @@
+threadID: string,
+localID?: string,
+text: string,
+ +sidebarCreation?: boolean,
};
export type SendMultimediaMessageRequest =
| {
+threadID: string,
+localID: string,
+ +sidebarCreation?: boolean,
+mediaIDs: $ReadOnlyArray<string>,
}
| {
+threadID: string,
+localID: string,
+ +sidebarCreation?: boolean,
+mediaMessageContents: $ReadOnlyArray<MediaMessageServerDBContent>,
};

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 16, 10:21 PM (21 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2505800
Default Alt Text
D6799.id22836.diff (4 KB)

Event Timeline