Fix sync message for editMessage
This commit is contained in:
parent
22a540f066
commit
9a7f1e86e2
2 changed files with 13 additions and 11 deletions
|
@ -1806,12 +1806,17 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
|
|||
const timestamp =
|
||||
this.get('editMessageTimestamp') || mainMessageTimestamp;
|
||||
|
||||
const encodedContent = isEditedMessage
|
||||
? {
|
||||
encodedEditMessage: dataMessage,
|
||||
}
|
||||
: {
|
||||
encodedDataMessage: dataMessage,
|
||||
};
|
||||
|
||||
return handleMessageSend(
|
||||
messaging.sendSyncMessage({
|
||||
encodedDataMessage: dataMessage,
|
||||
editedMessageTimestamp: isEditedMessage
|
||||
? mainMessageTimestamp
|
||||
: undefined,
|
||||
...encodedContent,
|
||||
timestamp,
|
||||
destination: conv.get('e164'),
|
||||
destinationUuid: conv.get('uuid'),
|
||||
|
|
|
@ -1181,8 +1181,8 @@ export default class MessageSender {
|
|||
// Note: this is used for sending real messages to your other devices after sending a
|
||||
// message to others.
|
||||
async sendSyncMessage({
|
||||
editedMessageTimestamp,
|
||||
encodedDataMessage,
|
||||
encodedEditMessage,
|
||||
timestamp,
|
||||
destination,
|
||||
destinationUuid,
|
||||
|
@ -1195,8 +1195,8 @@ export default class MessageSender {
|
|||
storyMessage,
|
||||
storyMessageRecipients,
|
||||
}: Readonly<{
|
||||
editedMessageTimestamp?: number;
|
||||
encodedDataMessage?: Uint8Array;
|
||||
encodedEditMessage?: Uint8Array;
|
||||
timestamp: number;
|
||||
destination: string | undefined;
|
||||
destinationUuid: string | null | undefined;
|
||||
|
@ -1214,11 +1214,8 @@ export default class MessageSender {
|
|||
const sentMessage = new Proto.SyncMessage.Sent();
|
||||
sentMessage.timestamp = Long.fromNumber(timestamp);
|
||||
|
||||
if (editedMessageTimestamp && encodedDataMessage) {
|
||||
const dataMessage = Proto.DataMessage.decode(encodedDataMessage);
|
||||
const editMessage = new Proto.EditMessage();
|
||||
editMessage.dataMessage = dataMessage;
|
||||
editMessage.targetSentTimestamp = Long.fromNumber(editedMessageTimestamp);
|
||||
if (encodedEditMessage) {
|
||||
const editMessage = Proto.EditMessage.decode(encodedEditMessage);
|
||||
sentMessage.editMessage = editMessage;
|
||||
} else if (encodedDataMessage) {
|
||||
const dataMessage = Proto.DataMessage.decode(encodedDataMessage);
|
||||
|
|
Loading…
Reference in a new issue