View Once: Allow for missing sender; only require senderUuid

This commit is contained in:
Scott Nonnenberg 2021-05-18 13:27:16 -07:00
parent 392822372b
commit bcaca1ebd5
3 changed files with 7 additions and 12 deletions

View File

@ -1801,11 +1801,6 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
if (!fromSync) {
const sender = this.getSource();
if (sender === undefined) {
throw new Error('sender is undefined');
}
const senderUuid = this.getSourceUuid();
if (senderUuid === undefined) {

6
ts/textsecure.d.ts vendored
View File

@ -1153,9 +1153,9 @@ export declare namespace SyncMessageClass {
type?: number;
}
class ViewOnceOpen {
sender?: string;
senderUuid?: string;
timestamp?: ProtoBinaryType;
sender: string | null;
senderUuid: string | null;
timestamp?: ProtoBinaryType | null;
}
class FetchLatest {
static Type: {

View File

@ -1251,7 +1251,7 @@ export default class MessageSender {
}
async syncViewOnceOpen(
sender: string,
sender: string | undefined,
senderUuid: string,
timestamp: number,
options?: SendOptionsType
@ -1266,9 +1266,9 @@ export default class MessageSender {
const syncMessage = this.createSyncMessage();
const viewOnceOpen = new window.textsecure.protobuf.SyncMessage.ViewOnceOpen();
viewOnceOpen.sender = sender;
viewOnceOpen.senderUuid = senderUuid;
viewOnceOpen.timestamp = timestamp;
viewOnceOpen.sender = sender || null;
viewOnceOpen.senderUuid = senderUuid || null;
viewOnceOpen.timestamp = timestamp || null;
syncMessage.viewOnceOpen = viewOnceOpen;
const contentMessage = new window.textsecure.protobuf.Content();