Page MenuHomePhabricator

D8373.diff
No OneTemporary

D8373.diff

diff --git a/lib/utils/message-ops-utils.js b/lib/utils/message-ops-utils.js
--- a/lib/utils/message-ops-utils.js
+++ b/lib/utils/message-ops-utils.js
@@ -2,7 +2,11 @@
import _keyBy from 'lodash/fp/keyBy.js';
-import { contentStringForMediaArray } from '../media/media-utils.js';
+import {
+ contentStringForMediaArray,
+ encryptedMediaBlobURI,
+ encryptedVideoThumbnailBlobURI,
+} from '../media/media-utils.js';
import { messageID } from '../shared/message-utils.js';
import { messageSpecs } from '../shared/messages/message-specs.js';
import type {
@@ -41,7 +45,7 @@
const mediaURI =
m.type === 'encrypted_photo' || m.type === 'encrypted_video'
- ? m.holder
+ ? encryptedMediaBlobURI(m)
: m.uri;
clientDBMediaInfos.push({
id: m.id,
@@ -57,7 +61,9 @@
});
if (m.type === 'video' || m.type === 'encrypted_video') {
const thumbnailURI =
- m.type === 'encrypted_video' ? m.thumbnailHolder : m.thumbnailURI;
+ m.type === 'encrypted_video'
+ ? encryptedVideoThumbnailBlobURI(m)
+ : m.thumbnailURI;
clientDBMediaInfos.push({
id: m.thumbnailID,
uri: thumbnailURI,
@@ -142,7 +148,7 @@
image = {
id: media.uploadID,
type: 'encrypted_photo',
- holder: mediaMap[media.uploadID].uri,
+ blobURI: mediaMap[media.uploadID].uri,
dimensions,
encryptionKey,
thumbHash,
@@ -174,12 +180,12 @@
const video: EncryptedVideo = {
id: media.uploadID,
type: 'encrypted_video',
- holder: mediaMap[media.uploadID].uri,
+ blobURI: mediaMap[media.uploadID].uri,
dimensions,
loop,
encryptionKey,
thumbnailID: media.thumbnailUploadID,
- thumbnailHolder: mediaMap[media.thumbnailUploadID].uri,
+ thumbnailBlobURI: mediaMap[media.thumbnailUploadID].uri,
thumbnailEncryptionKey,
thumbnailThumbHash,
};
diff --git a/lib/utils/message-ops-utils.test.js b/lib/utils/message-ops-utils.test.js
--- a/lib/utils/message-ops-utils.test.js
+++ b/lib/utils/message-ops-utils.test.js
@@ -477,7 +477,7 @@
{
id: 'localUpload0',
type: 'encrypted_photo',
- holder:
+ blobURI:
'assets-library://asset/asset.jpeg?id=6F1BEA56-3875-474C-B3AF-B11DEDCBAFF2&ext=jpeg',
encryptionKey: 'someKey',
dimensions: { height: 1010, width: 576 },
@@ -528,13 +528,13 @@
{
id: 'localUpload0',
type: 'encrypted_video',
- holder:
+ blobURI:
'assets-library://asset/asset.mov?id=6F1BEA56-3875-474C-B3AF-B11DEDCBAFF2&ext=mov',
encryptionKey: 'someVideoKey',
dimensions: { height: 1010, width: 576 },
loop: false,
thumbnailID: 'localUpload1',
- thumbnailHolder:
+ thumbnailBlobURI:
'assets-library://asset/asset.jpeg?id=6F1BEA56-3875-474C-B3AF-B11DEDCBAFF2&ext=jpeg',
thumbnailEncryptionKey: 'someThumbKey',
thumbnailThumbHash: 'thumb',
diff --git a/native/media/multimedia.react.js b/native/media/multimedia.react.js
--- a/native/media/multimedia.react.js
+++ b/native/media/multimedia.react.js
@@ -6,6 +6,10 @@
import * as React from 'react';
import { View, StyleSheet } from 'react-native';
+import {
+ encryptedMediaBlobURI,
+ encryptedVideoThumbnailBlobURI,
+} from 'lib/media/media-utils.js';
import type { MediaInfo, AvatarMediaInfo } from 'lib/types/media-types.js';
import EncryptedImage from './encrypted-image.react.js';
@@ -182,16 +186,20 @@
thumbHash: mediaInfo.thumbnailThumbHash,
};
} else if (mediaInfo.type === 'encrypted_photo') {
+ // destructuring needed for Flow
+ const { index, ...media } = mediaInfo;
return {
kind: 'encrypted',
- blobURI: mediaInfo.holder,
+ blobURI: encryptedMediaBlobURI(media),
encryptionKey: mediaInfo.encryptionKey,
thumbHash: mediaInfo.thumbHash,
};
} else if (mediaInfo.type === 'encrypted_video') {
+ // destructuring needed for Flow
+ const { index, ...media } = mediaInfo;
return {
kind: 'encrypted',
- blobURI: mediaInfo.thumbnailHolder,
+ blobURI: encryptedVideoThumbnailBlobURI(media),
encryptionKey: mediaInfo.thumbnailEncryptionKey,
thumbHash: mediaInfo.thumbnailThumbHash,
};
diff --git a/web/chat/multimedia-message.react.js b/web/chat/multimedia-message.react.js
--- a/web/chat/multimedia-message.react.js
+++ b/web/chat/multimedia-message.react.js
@@ -3,6 +3,10 @@
import invariant from 'invariant';
import * as React from 'react';
+import {
+ encryptedMediaBlobURI,
+ encryptedVideoThumbnailBlobURI,
+} from 'lib/media/media-utils.js';
import { type ChatMessageInfoItem } from 'lib/selectors/chat-selectors.js';
import { messageTypes } from 'lib/types/message-types-enum.js';
import { type ThreadInfo } from 'lib/types/thread-types.js';
@@ -45,14 +49,13 @@
const { type, uri, thumbnailURI, dimensions } = singleMedia;
mediaSource = { type, uri, thumbHash, thumbnailURI, dimensions };
} else {
- const {
- type,
- holder: blobURI,
- encryptionKey,
- thumbnailHolder: thumbnailBlobURI,
- thumbnailEncryptionKey,
- dimensions,
- } = singleMedia;
+ const { type, encryptionKey, thumbnailEncryptionKey, dimensions } =
+ singleMedia;
+ const blobURI = encryptedMediaBlobURI(singleMedia);
+ const thumbnailBlobURI =
+ singleMedia.type === 'encrypted_video'
+ ? encryptedVideoThumbnailBlobURI(singleMedia)
+ : null;
mediaSource = {
type,
blobURI,
diff --git a/web/modals/threads/gallery/thread-settings-media-gallery.react.js b/web/modals/threads/gallery/thread-settings-media-gallery.react.js
--- a/web/modals/threads/gallery/thread-settings-media-gallery.react.js
+++ b/web/modals/threads/gallery/thread-settings-media-gallery.react.js
@@ -4,6 +4,10 @@
import { fetchThreadMedia } from 'lib/actions/thread-actions.js';
import { useModalContext } from 'lib/components/modal-provider.react.js';
+import {
+ encryptedMediaBlobURI,
+ encryptedVideoThumbnailBlobURI,
+} from 'lib/media/media-utils.js';
import type { Media } from 'lib/types/media-types.js';
import type { ThreadInfo } from 'lib/types/thread-types.js';
import { useServerCall } from 'lib/utils/action-utils.js';
@@ -63,16 +67,15 @@
thumbnailURI,
};
} else {
- const {
- holder: blobURI,
- encryptionKey,
- thumbnailHolder: thumbnailBlobURI,
- thumbnailEncryptionKey,
- } = media;
+ const { encryptionKey, thumbnailEncryptionKey } = media;
+ const thumbnailBlobURI =
+ media.type === 'encrypted_video'
+ ? encryptedVideoThumbnailBlobURI(media)
+ : null;
mediaInfo = {
...mediaInfo,
type: media.type,
- blobURI,
+ blobURI: encryptedMediaBlobURI(media),
encryptionKey,
thumbnailBlobURI,
thumbnailEncryptionKey,
@@ -114,14 +117,14 @@
} else if (media.type === 'encrypted_photo') {
imageSource = {
kind: 'encrypted',
- blobURI: media.holder,
+ blobURI: encryptedMediaBlobURI(media),
encryptionKey: media.encryptionKey,
thumbHash: media.thumbHash,
};
} else {
imageSource = {
kind: 'encrypted',
- blobURI: media.thumbnailHolder,
+ blobURI: encryptedVideoThumbnailBlobURI(media),
encryptionKey: media.thumbnailEncryptionKey,
thumbHash: media.thumbnailThumbHash,
};

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 3, 2:52 PM (2 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2612072
Default Alt Text
D8373.diff (7 KB)

Event Timeline