Prevent send and show toast for invalid conversations
This commit is contained in:
parent
34be0744d2
commit
3ee830ae63
5 changed files with 83 additions and 45 deletions
|
@ -266,7 +266,8 @@ export class ConversationModel extends window.Backbone.Model<
|
|||
return false;
|
||||
}
|
||||
|
||||
return fromEncodedBinaryToArrayBuffer(groupId).byteLength === 16;
|
||||
const buffer = fromEncodedBinaryToArrayBuffer(groupId);
|
||||
return buffer.byteLength === window.Signal.Groups.ID_V1_LENGTH;
|
||||
}
|
||||
|
||||
isGroupV2(): boolean {
|
||||
|
@ -277,7 +278,10 @@ export class ConversationModel extends window.Backbone.Model<
|
|||
|
||||
const groupVersion = this.get('groupVersion') || 0;
|
||||
|
||||
return groupVersion === 2 && base64ToArrayBuffer(groupId).byteLength === 32;
|
||||
return (
|
||||
groupVersion === 2 &&
|
||||
base64ToArrayBuffer(groupId).byteLength === window.Signal.Groups.ID_LENGTH
|
||||
);
|
||||
}
|
||||
|
||||
isMemberPending(conversationId: string): boolean {
|
||||
|
@ -822,6 +826,10 @@ export class ConversationModel extends window.Backbone.Model<
|
|||
});
|
||||
}
|
||||
|
||||
isValid(): boolean {
|
||||
return this.isPrivate() || this.isGroupV1() || this.isGroupV2();
|
||||
}
|
||||
|
||||
maybeRepairGroupV2(data: {
|
||||
masterKey: string;
|
||||
secretParams: string;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue