Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3515711
D7235.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D7235.diff
View Options
diff --git a/lib/reducers/message-reducer.js b/lib/reducers/message-reducer.js
--- a/lib/reducers/message-reducer.js
+++ b/lib/reducers/message-reducer.js
@@ -1236,6 +1236,57 @@
) {
media.push({ ...singleMedia, ...mediaUpdate });
replaced = true;
+ } else if (
+ singleMedia.type === 'photo' &&
+ mediaUpdate.type === 'encrypted_photo'
+ ) {
+ // extract fields that are absent in encrypted_photo type
+ const { uri, localMediaSelection, ...original } = singleMedia;
+ const { holder, encryptionKey, ...update } = mediaUpdate;
+ invariant(
+ holder && encryptionKey,
+ 'holder and encryptionKey are required for encrypted_photo message',
+ );
+ media.push({
+ ...original,
+ ...update,
+ type: 'encrypted_photo',
+ holder,
+ encryptionKey,
+ });
+ replaced = true;
+ } else if (
+ singleMedia.type === 'video' &&
+ mediaUpdate.type === 'encrypted_video'
+ ) {
+ const { uri, thumbnailURI, localMediaSelection, ...original } =
+ singleMedia;
+ const {
+ holder,
+ encryptionKey,
+ thumbnailHolder,
+ thumbnailEncryptionKey,
+ ...update
+ } = mediaUpdate;
+ invariant(
+ holder && encryptionKey,
+ 'holder and encryptionKey are required for encrypted_video message',
+ );
+ invariant(
+ thumbnailHolder && thumbnailEncryptionKey,
+ 'thumbnailHolder and thumbnailEncryptionKey are required for ' +
+ 'encrypted_video message',
+ );
+ media.push({
+ ...original,
+ ...update,
+ type: 'encrypted_video',
+ holder,
+ encryptionKey,
+ thumbnailHolder,
+ thumbnailEncryptionKey,
+ });
+ replaced = true;
}
}
updatedMessage = { ...message, media };
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 23, 9:42 AM (18 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2694391
Default Alt Text
D7235.diff (2 KB)
Attached To
Mode
D7235: [lib] Support encrypted media types in updateMultimediaMessageMediaAction
Attached
Detach File
Event Timeline
Log In to Comment