Page MenuHomePhabricator

D5298.id17361.diff
No OneTemporary

D5298.id17361.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
@@ -12,17 +12,34 @@
type ClientDBMessageStoreOperation,
} from '../types/message-types';
-function translateMediaToClientDBMediaInfo(media: Media): ClientDBMediaInfo {
- return {
- id: media.id,
- uri: media.uri,
- type: media.type,
- extras: JSON.stringify({
- dimensions: media.dimensions,
- loop: media.type === 'video' ? media.loop : false,
- local_media_selection: media.localMediaSelection,
- }),
- };
+function translateMediaToClientDBMediaInfos(
+ media: $ReadOnlyArray<Media>,
+): $ReadOnlyArray<ClientDBMediaInfo> {
+ const clientDBMediaInfos = [];
+ for (const m of media) {
+ clientDBMediaInfos.push({
+ id: m.id,
+ uri: m.uri,
+ type: m.type,
+ extras: JSON.stringify({
+ dimensions: m.dimensions,
+ loop: m.type === 'video' ? m.loop : false,
+ local_media_selection: m.localMediaSelection,
+ }),
+ });
+ if (m.type === 'video') {
+ clientDBMediaInfos.push({
+ id: m.thumbnailID,
+ uri: m.thumbnailURI,
+ type: 'photo',
+ extras: JSON.stringify({
+ dimensions: m.dimensions,
+ loop: false,
+ }),
+ });
+ }
+ }
+ return clientDBMediaInfos;
}
function translateClientDBMediaInfoToImage(
@@ -69,7 +86,7 @@
media_infos:
rawMessageInfo.type === messageTypes.IMAGES ||
rawMessageInfo.type === messageTypes.MULTIMEDIA
- ? rawMessageInfo.media.map(translateMediaToClientDBMediaInfo)
+ ? translateMediaToClientDBMediaInfos(rawMessageInfo.media)
: null,
};
}
@@ -111,7 +128,6 @@
export {
translateClientDBMediaInfoToImage,
- translateMediaToClientDBMediaInfo,
translateRawMessageInfoToClientDBMessageInfo,
translateClientDBMessageInfoToRawMessageInfo,
translateClientDBMessageInfosToRawMessageInfos,

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 24, 4:24 AM (18 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2694617
Default Alt Text
D5298.id17361.diff (1 KB)

Event Timeline