Changeset View
Changeset View
Standalone View
Standalone View
lib/types/messages/media.js
Show First 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | ): $ReadOnlyArray<string> { | ||||
} | } | ||||
return uploadIDs; | return uploadIDs; | ||||
} | } | ||||
function getMediaMessageServerDBContentsFromMedia( | function getMediaMessageServerDBContentsFromMedia( | ||||
media: $ReadOnlyArray<Media>, | media: $ReadOnlyArray<Media>, | ||||
): $ReadOnlyArray<MediaMessageServerDBContent> { | ): $ReadOnlyArray<MediaMessageServerDBContent> { | ||||
return media.map(m => { | return media.map(m => { | ||||
if (m.type === 'photo') { | if (m.type === 'photo' || m.type === 'encrypted_photo') { | ||||
return { type: 'photo', uploadID: m.id }; | return { type: 'photo', uploadID: m.id }; | ||||
} else { | } else if (m.type === 'video' || m.type === 'encrypted_video') { | ||||
return { | return { | ||||
type: 'video', | type: 'video', | ||||
uploadID: m.id, | uploadID: m.id, | ||||
thumbnailUploadID: m.thumbnailID, | thumbnailUploadID: m.thumbnailID, | ||||
}; | }; | ||||
} | } | ||||
throw new Error(`Unexpected media type: ${m.type}`); | |||||
}); | }); | ||||
} | } | ||||
export { | export { | ||||
getUploadIDsFromMediaMessageServerDBContents, | getUploadIDsFromMediaMessageServerDBContents, | ||||
getMediaMessageServerDBContentsFromMedia, | getMediaMessageServerDBContentsFromMedia, | ||||
}; | }; |