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) { if (!fromSync) {
const sender = this.getSource(); const sender = this.getSource();
if (sender === undefined) {
throw new Error('sender is undefined');
}
const senderUuid = this.getSourceUuid(); const senderUuid = this.getSourceUuid();
if (senderUuid === undefined) { if (senderUuid === undefined) {

6
ts/textsecure.d.ts vendored
View file

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

View file

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