Fix edit message in Note to Self
This commit is contained in:
parent
557b86f52e
commit
b705609341
3 changed files with 14 additions and 8 deletions
|
@ -221,7 +221,7 @@ export async function sendNormalMessage(
|
|||
// or sending a story to a group where all other users don't have the stories
|
||||
// capabilities (effectively a 'lonely group' in the context of stories)
|
||||
log.info('sending sync message only');
|
||||
const dataMessage = await messaging.getDataMessage({
|
||||
const dataMessage = await messaging.getDataOrEditMessage({
|
||||
attachments,
|
||||
body,
|
||||
bodyRanges,
|
||||
|
|
|
@ -168,7 +168,7 @@ export async function sendReaction(
|
|||
|
||||
if (recipientIdentifiersWithoutMe.length === 0) {
|
||||
log.info('sending sync reaction message only');
|
||||
const dataMessage = await messaging.getDataMessage({
|
||||
const dataMessage = await messaging.getDataOrEditMessage({
|
||||
attachments: [],
|
||||
expireTimer,
|
||||
groupV2: conversation.getGroupV2Info({
|
||||
|
|
|
@ -566,10 +566,6 @@ class Message {
|
|||
this.dataMessage = proto;
|
||||
return proto;
|
||||
}
|
||||
|
||||
encode(): Uint8Array {
|
||||
return Proto.DataMessage.encode(this.toProto()).finish();
|
||||
}
|
||||
}
|
||||
|
||||
type AddPniSignatureMessageToProtoOptionsType = Readonly<{
|
||||
|
@ -687,11 +683,21 @@ export default class MessageSender {
|
|||
return textAttachment;
|
||||
}
|
||||
|
||||
async getDataMessage(
|
||||
async getDataOrEditMessage(
|
||||
options: Readonly<MessageOptionsType>
|
||||
): Promise<Uint8Array> {
|
||||
const message = await this.getHydratedMessage(options);
|
||||
return message.encode();
|
||||
const dataMessage = message.toProto();
|
||||
|
||||
if (options.editedMessageTimestamp) {
|
||||
const editMessage = new Proto.EditMessage();
|
||||
editMessage.dataMessage = dataMessage;
|
||||
editMessage.targetSentTimestamp = Long.fromNumber(
|
||||
options.editedMessageTimestamp
|
||||
);
|
||||
return Proto.EditMessage.encode(editMessage).finish();
|
||||
}
|
||||
return Proto.DataMessage.encode(dataMessage).finish();
|
||||
}
|
||||
|
||||
async getStoryMessage({
|
||||
|
|
Loading…
Reference in a new issue