Page MenuHomePhabricator

D6482.diff
No OneTemporary

D6482.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
@@ -189,12 +189,13 @@
);
if (request.mediaIDs) {
- await assignMedia(viewer, request.mediaIDs, id);
+ await assignMedia(viewer, request.mediaIDs, id, threadID);
} else {
await assignMessageContainerToMedia(
viewer,
request.mediaMessageContents,
id,
+ threadID,
);
}
diff --git a/keyserver/src/updaters/upload-updaters.js b/keyserver/src/updaters/upload-updaters.js
--- a/keyserver/src/updaters/upload-updaters.js
+++ b/keyserver/src/updaters/upload-updaters.js
@@ -10,11 +10,13 @@
viewer: Viewer,
mediaIDs: $ReadOnlyArray<string>,
containerID: string,
+ threadID: string,
): Promise<void> {
const query = SQL`
UPDATE uploads
- SET container = ${containerID}
- WHERE id IN (${mediaIDs}) AND uploader = ${viewer.id} AND container IS NULL
+ SET container = ${containerID}, thread = ${threadID}
+ WHERE id IN (${mediaIDs}) AND uploader = ${viewer.id}
+ AND container IS NULL AND thread IS NULL
`;
await dbQuery(query);
}
@@ -23,13 +25,15 @@
viewer: Viewer,
mediaMessageContents: $ReadOnlyArray<MediaMessageServerDBContent>,
containerID: string,
+ threadID: string,
): Promise<void> {
const uploadIDs =
getUploadIDsFromMediaMessageServerDBContents(mediaMessageContents);
const query = SQL`
UPDATE uploads
- SET container = ${containerID}
- WHERE id IN (${uploadIDs}) AND uploader = ${viewer.id} AND container IS NULL
+ SET container = ${containerID}, thread = ${threadID}
+ WHERE id IN (${uploadIDs}) AND uploader = ${viewer.id}
+ AND container IS NULL AND thread IS NULL
`;
await dbQuery(query);
}

File Metadata

Mime Type
text/plain
Expires
Thu, Nov 28, 12:00 PM (21 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2593927
Default Alt Text
D6482.diff (1 KB)

Event Timeline