Page MenuHomePhabricator

D6482.id22418.diff
No OneTemporary

D6482.id22418.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
@@ -182,12 +182,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,14 +25,16 @@
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
Sun, Nov 24, 8:59 PM (19 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2577301
Default Alt Text
D6482.id22418.diff (1 KB)

Event Timeline