Migrate message ids to UUIDv7

This commit is contained in:
Fedor Indutny 2024-10-07 20:17:03 -07:00 committed by GitHub
parent c1b5811c39
commit 60d7cbff3e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 203 additions and 147 deletions

View file

@ -11,7 +11,6 @@ import {
pick,
union,
} from 'lodash';
import { v4 as generateUuid } from 'uuid';
import type {
CustomError,
@ -26,6 +25,7 @@ import { isNotNil } from '../util/isNotNil';
import { isNormalNumber } from '../util/isNormalNumber';
import { strictAssert } from '../util/assert';
import { hydrateStoryContext } from '../util/hydrateStoryContext';
import { generateMessageId } from '../util/generateMessageId';
import { drop } from '../util/drop';
import type { ConversationModel } from './conversations';
import type {
@ -1642,7 +1642,8 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
}
}
const messageId = message.get('id') || generateUuid();
const messageId =
message.get('id') || generateMessageId(this.get('received_at')).id;
// Send delivery receipts, but only for non-story sealed sender messages
// and not for messages from unaccepted conversations