Message schema 6: Change classification of media and documents
For an easier implementation, we change our original definition of `initializeAttachmentMetadata`. This means we have to re-run it marked as version 6 and mark schema version 5 as deprecated as its definition has changed.
This commit is contained in:
parent
f4a5bc9907
commit
16bc1d34c6
4 changed files with 120 additions and 15 deletions
|
@ -25,13 +25,21 @@ const PRIVATE = 'private';
|
|||
// - Attachments: Write attachment data to disk and store relative path to it.
|
||||
// Version 4
|
||||
// - Quotes: Write thumbnail data to disk and store relative path to it.
|
||||
// Version 5
|
||||
// Version 5 (deprecated)
|
||||
// - Attachments: Track number and kind of attachments for media gallery
|
||||
// - `hasAttachments?: 1 | 0`
|
||||
// - `hasVisualMediaAttachments?: 1 | undefined` (for media gallery ‘Media’ view)
|
||||
// - `hasFileAttachments?: 1 | undefined` (for media gallery ‘Documents’ view)
|
||||
// - IMPORTANT: Version 7 changes the classification of visual media and files.
|
||||
// Therefore version 5 is considered deprecated. For an easier implementation,
|
||||
// new files have the same classification in version 5 as in version 7.
|
||||
// Version 6
|
||||
// - Contact: Write contact avatar to disk, ensure contact data is well-formed
|
||||
// Version 7 (supersedes attachment classification in version 5)
|
||||
// - Attachments: Update classification for:
|
||||
// - `hasVisualMediaAttachments`: Include all images and video regardless of
|
||||
// whether Chromium can render it or not.
|
||||
// - `hasFileAttachments`: Exclude voice messages.
|
||||
|
||||
const INITIAL_SCHEMA_VERSION = 0;
|
||||
|
||||
|
@ -228,6 +236,10 @@ const toVersion6 = exports._withSchemaVersion(
|
|||
Contact.parseAndWriteAvatar(Attachment.migrateDataToFileSystem)
|
||||
)
|
||||
);
|
||||
// IMPORTANT: We’ve updated our definition of `initializeAttachmentMetadata`, so
|
||||
// we need to run it again on existing items that have previously been incorrectly
|
||||
// classified:
|
||||
const toVersion7 = exports._withSchemaVersion(7, initializeAttachmentMetadata);
|
||||
|
||||
const VERSIONS = [
|
||||
toVersion0,
|
||||
|
@ -236,6 +248,8 @@ const VERSIONS = [
|
|||
toVersion3,
|
||||
toVersion4,
|
||||
toVersion5,
|
||||
toVersion6,
|
||||
toVersion7,
|
||||
];
|
||||
exports.CURRENT_SCHEMA_VERSION = VERSIONS.length - 1;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue