Persist reaction.receivedAtDate

This commit is contained in:
Fedor Indutny 2023-12-08 02:30:20 +01:00 committed by GitHub
parent b2a3605d77
commit 47c49d0a20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 9 additions and 0 deletions

View file

@ -2397,6 +2397,7 @@ export async function startApp(): Promise<void> {
storyReactionMessage: message, storyReactionMessage: message,
targetAuthorAci, targetAuthorAci,
targetTimestamp: reaction.targetTimestamp, targetTimestamp: reaction.targetTimestamp,
receivedAtDate: data.receivedAtDate,
timestamp, timestamp,
}; };
@ -2731,6 +2732,7 @@ export async function startApp(): Promise<void> {
storyReactionMessage: message, storyReactionMessage: message,
targetAuthorAci, targetAuthorAci,
targetTimestamp: reaction.targetTimestamp, targetTimestamp: reaction.targetTimestamp,
receivedAtDate: data.receivedAtDate,
timestamp, timestamp,
}; };
drop(Reactions.onReaction(attributes)); drop(Reactions.onReaction(attributes));

View file

@ -28,6 +28,7 @@ export type ReactionAttributesType = {
targetAuthorAci: AciString; targetAuthorAci: AciString;
targetTimestamp: number; targetTimestamp: number;
timestamp: number; timestamp: number;
receivedAtDate: number;
}; };
const reactions = new Map<string, ReactionAttributesType>(); const reactions = new Map<string, ReactionAttributesType>();

1
ts/model-types.d.ts vendored
View file

@ -110,6 +110,7 @@ export type MessageReactionType = {
fromId: string; fromId: string;
targetTimestamp: number; targetTimestamp: number;
timestamp: number; timestamp: number;
receivedAtDate: undefined | number;
isSentByConversationId?: Record<string, boolean>; isSentByConversationId?: Record<string, boolean>;
}; };

View file

@ -2446,6 +2446,7 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
fromId: reaction.fromId, fromId: reaction.fromId,
targetTimestamp: reaction.targetTimestamp, targetTimestamp: reaction.targetTimestamp,
timestamp: reaction.timestamp, timestamp: reaction.timestamp,
receivedAtDate: reaction.receivedAtDate,
isSentByConversationId: isFromThisDevice isSentByConversationId: isFromThisDevice
? zipObject(conversation.getMemberConversationIds(), repeat(false)) ? zipObject(conversation.getMemberConversationIds(), repeat(false))
: undefined, : undefined,

View file

@ -109,6 +109,7 @@ export async function enqueueReactionForSend({
storyReactionMessage, storyReactionMessage,
targetAuthorAci, targetAuthorAci,
targetTimestamp, targetTimestamp,
receivedAtDate: timestamp,
timestamp, timestamp,
}; };

View file

@ -26,6 +26,7 @@ describe('reaction utilities', () => {
fromId: OUR_CONVO_ID, fromId: OUR_CONVO_ID,
targetTimestamp: Date.now(), targetTimestamp: Date.now(),
timestamp: Date.now(), timestamp: Date.now(),
receivedAtDate: Date.now(),
...(isPending ? { isSentByConversationId: { [uuid()]: false } } : {}), ...(isPending ? { isSentByConversationId: { [uuid()]: false } } : {}),
}); });

View file

@ -1606,6 +1606,7 @@ describe('both/state/ducks/conversations', () => {
emoji: '✨', emoji: '✨',
fromId: 'some-other-id', fromId: 'some-other-id',
timestamp: 2222, timestamp: 2222,
receivedAtDate: 3333,
targetTimestamp: 1111, targetTimestamp: 1111,
}, },
], ],
@ -1636,6 +1637,7 @@ describe('both/state/ducks/conversations', () => {
emoji: '✨', emoji: '✨',
fromId: 'some-other-id', fromId: 'some-other-id',
timestamp: 2222, timestamp: 2222,
receivedAtDate: 3333,
targetTimestamp: 1111, targetTimestamp: 1111,
}, },
], ],