Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3332850
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/keyserver/src/updaters/upload-updaters.js b/keyserver/src/updaters/upload-updaters.js
index 5c284d4b3..fa54d1778 100644
--- a/keyserver/src/updaters/upload-updaters.js
+++ b/keyserver/src/updaters/upload-updaters.js
@@ -1,41 +1,47 @@
// @flow
import type { MediaMessageServerDBContent } from 'lib/types/messages/media.js';
import { getUploadIDsFromMediaMessageServerDBContents } from 'lib/types/messages/media.js';
import { dbQuery, SQL } from '../database/database.js';
import type { Viewer } from '../session/viewer.js';
async function assignImages(
viewer: Viewer,
mediaIDs: $ReadOnlyArray<string>,
containerID: string,
threadID: string,
): Promise<void> {
const query = SQL`
UPDATE uploads
SET container = ${containerID}, thread = ${threadID}
- WHERE id IN (${mediaIDs}) AND uploader = ${viewer.id}
- AND container IS NULL AND thread IS NULL
+ WHERE id IN (${mediaIDs})
+ AND uploader = ${viewer.id}
+ AND container IS NULL
+ AND user_container IS NULL
+ AND thread IS NULL
`;
await dbQuery(query);
}
async function assignMessageContainerToMedia(
viewer: Viewer,
mediaMessageContents: $ReadOnlyArray<MediaMessageServerDBContent>,
containerID: string,
threadID: string,
): Promise<void> {
const uploadIDs =
getUploadIDsFromMediaMessageServerDBContents(mediaMessageContents);
const query = SQL`
UPDATE uploads
SET container = ${containerID}, thread = ${threadID}
- WHERE id IN (${uploadIDs}) AND uploader = ${viewer.id}
- AND container IS NULL AND thread IS NULL
+ WHERE id IN (${uploadIDs})
+ AND uploader = ${viewer.id}
+ AND container IS NULL
+ AND user_container IS NULL
+ AND thread IS NULL
`;
await dbQuery(query);
}
export { assignImages, assignMessageContainerToMedia };
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Nov 23, 2:20 AM (1 d, 5 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2559371
Default Alt Text
(1 KB)
Attached To
Mode
rCOMM Comm
Attached
Detach File
Event Timeline
Log In to Comment