mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-27 03:43:27 +01:00
Migrate message ids to UUIDv7
This commit is contained in:
@@ -2,9 +2,10 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import noop from 'lodash/noop';
|
||||
import { v4 as generateUuid } from 'uuid';
|
||||
import { v7 as generateUuid } from 'uuid';
|
||||
|
||||
import { DataWriter } from '../sql/Client';
|
||||
import type { MessageModel } from '../models/messages';
|
||||
import type { ReactionAttributesType } from '../messageModifiers/Reactions';
|
||||
import { ReactionSource } from './ReactionSource';
|
||||
import { __DEPRECATED$getMessageById } from '../messages/getMessageById';
|
||||
@@ -12,6 +13,7 @@ import { getSourceServiceId, isStory } from '../messages/helpers';
|
||||
import { strictAssert } from '../util/assert';
|
||||
import { isDirectConversation } from '../util/whatTypeOfConversation';
|
||||
import { incrementMessageCounter } from '../util/incrementMessageCounter';
|
||||
import { generateMessageId } from '../util/generateMessageId';
|
||||
import { repeat, zipObject } from '../util/iterables';
|
||||
import { getMessageSentTimestamp } from '../util/getMessageSentTimestamp';
|
||||
import { isAciString } from '../util/isAciString';
|
||||
@@ -87,31 +89,31 @@ export async function enqueueReactionForSend({
|
||||
: undefined;
|
||||
|
||||
// Only used in story scenarios, where we use a whole message to represent the reaction
|
||||
const storyReactionMessage = storyMessage
|
||||
? new window.Whisper.Message({
|
||||
id: generateUuid(),
|
||||
type: 'outgoing',
|
||||
conversationId: targetConversation.id,
|
||||
sent_at: timestamp,
|
||||
received_at: incrementMessageCounter(),
|
||||
received_at_ms: timestamp,
|
||||
timestamp,
|
||||
expireTimer,
|
||||
sendStateByConversationId: zipObject(
|
||||
targetConversation.getMemberConversationIds(),
|
||||
repeat({
|
||||
status: SendStatus.Pending,
|
||||
updatedAt: Date.now(),
|
||||
})
|
||||
),
|
||||
storyId: message.id,
|
||||
storyReaction: {
|
||||
emoji,
|
||||
targetAuthorAci,
|
||||
targetTimestamp,
|
||||
},
|
||||
})
|
||||
: undefined;
|
||||
let storyReactionMessage: MessageModel | undefined;
|
||||
if (storyMessage) {
|
||||
storyReactionMessage = new window.Whisper.Message({
|
||||
...generateMessageId(incrementMessageCounter()),
|
||||
type: 'outgoing',
|
||||
conversationId: targetConversation.id,
|
||||
sent_at: timestamp,
|
||||
received_at_ms: timestamp,
|
||||
timestamp,
|
||||
expireTimer,
|
||||
sendStateByConversationId: zipObject(
|
||||
targetConversation.getMemberConversationIds(),
|
||||
repeat({
|
||||
status: SendStatus.Pending,
|
||||
updatedAt: Date.now(),
|
||||
})
|
||||
),
|
||||
storyId: message.id,
|
||||
storyReaction: {
|
||||
emoji,
|
||||
targetAuthorAci,
|
||||
targetTimestamp,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
const reaction: ReactionAttributesType = {
|
||||
envelopeId: generateUuid(),
|
||||
|
||||
Reference in New Issue
Block a user