Ensure authorUuid is set in outgoing quotes
This commit is contained in:
parent
3468de255d
commit
d4d9688447
3 changed files with 39 additions and 19 deletions
|
@ -2521,6 +2521,10 @@ export class ConversationModel extends window.Backbone.Model<
|
||||||
// sending functionality. It will not be saved to the datbase.
|
// sending functionality. It will not be saved to the datbase.
|
||||||
const message = new window.Whisper.Message(attributes);
|
const message = new window.Whisper.Message(attributes);
|
||||||
|
|
||||||
|
// This is to ensure that the functions in send() and sendSyncMessage() don't save
|
||||||
|
// anything to the database.
|
||||||
|
message.doNotSave = true;
|
||||||
|
|
||||||
// We're offline!
|
// We're offline!
|
||||||
if (!window.textsecure.messaging) {
|
if (!window.textsecure.messaging) {
|
||||||
throw new Error('Cannot send reaction while offline!');
|
throw new Error('Cannot send reaction while offline!');
|
||||||
|
@ -2579,10 +2583,6 @@ export class ConversationModel extends window.Backbone.Model<
|
||||||
);
|
);
|
||||||
})();
|
})();
|
||||||
|
|
||||||
// This is to ensure that the functions in send() and sendSyncMessage() don't save
|
|
||||||
// anything to the database.
|
|
||||||
message.doNotSave = true;
|
|
||||||
|
|
||||||
return message.send(this.wrapSend(promise));
|
return message.send(this.wrapSend(promise));
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
window.log.error('Error sending reaction', reaction, target, error);
|
window.log.error('Error sending reaction', reaction, target, error);
|
||||||
|
|
18
ts/textsecure.d.ts
vendored
18
ts/textsecure.d.ts
vendored
|
@ -606,10 +606,10 @@ export declare namespace DataMessageClass {
|
||||||
|
|
||||||
// Note: deep nesting
|
// Note: deep nesting
|
||||||
class Quote {
|
class Quote {
|
||||||
id?: ProtoBigNumberType;
|
id: ProtoBigNumberType | null;
|
||||||
author?: string;
|
author: string | null;
|
||||||
authorUuid?: string;
|
authorUuid: string | null;
|
||||||
text?: string;
|
text: string | null;
|
||||||
attachments?: Array<DataMessageClass.Quote.QuotedAttachment>;
|
attachments?: Array<DataMessageClass.Quote.QuotedAttachment>;
|
||||||
bodyRanges?: Array<DataMessageClass.BodyRange>;
|
bodyRanges?: Array<DataMessageClass.BodyRange>;
|
||||||
}
|
}
|
||||||
|
@ -621,11 +621,11 @@ export declare namespace DataMessageClass {
|
||||||
}
|
}
|
||||||
|
|
||||||
class Reaction {
|
class Reaction {
|
||||||
emoji?: string;
|
emoji: string | null;
|
||||||
remove?: boolean;
|
remove: boolean | null;
|
||||||
targetAuthorE164?: string;
|
targetAuthorE164: string | null;
|
||||||
targetAuthorUuid?: string;
|
targetAuthorUuid: string | null;
|
||||||
targetTimestamp?: ProtoBigNumberType;
|
targetTimestamp: ProtoBigNumberType | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
class Delete {
|
class Delete {
|
||||||
|
|
|
@ -148,13 +148,26 @@ class Message {
|
||||||
|
|
||||||
profileKey?: ArrayBuffer;
|
profileKey?: ArrayBuffer;
|
||||||
|
|
||||||
quote?: any;
|
quote?: {
|
||||||
|
id?: number;
|
||||||
|
author?: string;
|
||||||
|
authorUuid?: string;
|
||||||
|
text?: string;
|
||||||
|
attachments?: Array<AttachmentType>;
|
||||||
|
bodyRanges?: BodyRangesType;
|
||||||
|
};
|
||||||
|
|
||||||
recipients: Array<string>;
|
recipients: Array<string>;
|
||||||
|
|
||||||
sticker?: any;
|
sticker?: any;
|
||||||
|
|
||||||
reaction?: any;
|
reaction?: {
|
||||||
|
emoji?: string;
|
||||||
|
remove?: boolean;
|
||||||
|
targetAuthorE164?: string;
|
||||||
|
targetAuthorUuid?: string;
|
||||||
|
targetTimestamp?: number;
|
||||||
|
};
|
||||||
|
|
||||||
timestamp: number;
|
timestamp: number;
|
||||||
|
|
||||||
|
@ -288,8 +301,14 @@ class Message {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.reaction) {
|
if (this.reaction) {
|
||||||
proto.reaction = this.reaction;
|
proto.reaction = new window.textsecure.protobuf.DataMessage.Reaction();
|
||||||
|
proto.reaction.emoji = this.reaction.emoji || null;
|
||||||
|
proto.reaction.remove = this.reaction.remove || null;
|
||||||
|
proto.reaction.targetAuthorE164 = this.reaction.targetAuthorE164 || null;
|
||||||
|
proto.reaction.targetAuthorUuid = this.reaction.targetAuthorUuid || null;
|
||||||
|
proto.reaction.targetTimestamp = this.reaction.targetTimestamp || null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Array.isArray(this.preview)) {
|
if (Array.isArray(this.preview)) {
|
||||||
proto.preview = this.preview.map(preview => {
|
proto.preview = this.preview.map(preview => {
|
||||||
const item = new window.textsecure.protobuf.DataMessage.Preview();
|
const item = new window.textsecure.protobuf.DataMessage.Preview();
|
||||||
|
@ -308,9 +327,10 @@ class Message {
|
||||||
proto.quote = new Quote();
|
proto.quote = new Quote();
|
||||||
const { quote } = proto;
|
const { quote } = proto;
|
||||||
|
|
||||||
quote.id = this.quote.id;
|
quote.id = this.quote.id || null;
|
||||||
quote.author = this.quote.author;
|
quote.author = this.quote.author || null;
|
||||||
quote.text = this.quote.text;
|
quote.authorUuid = this.quote.authorUuid || null;
|
||||||
|
quote.text = this.quote.text || null;
|
||||||
quote.attachments = (this.quote.attachments || []).map(
|
quote.attachments = (this.quote.attachments || []).map(
|
||||||
(attachment: AttachmentType) => {
|
(attachment: AttachmentType) => {
|
||||||
const quotedAttachment = new QuotedAttachment();
|
const quotedAttachment = new QuotedAttachment();
|
||||||
|
|
Loading…
Reference in a new issue