New Group administration: update title and avatar

This commit is contained in:
Evan Hahn 2021-03-09 13:16:56 -06:00 committed by Josh Perez
parent 468d491d34
commit 9f5335b854
25 changed files with 806 additions and 61 deletions

View file

@ -1716,6 +1716,27 @@ export class ConversationModel extends window.Backbone.Model<
});
}
async updateGroupAttributesV2(
attributes: Readonly<{
avatar?: undefined | ArrayBuffer;
title?: string;
}>
): Promise<void> {
await this.modifyGroupV2({
name: 'updateGroupAttributesV2',
createGroupChange: () =>
window.Signal.Groups.buildUpdateAttributesChange(
{
id: this.id,
publicParams: this.get('publicParams'),
revision: this.get('revision'),
secretParams: this.get('secretParams'),
},
attributes
),
});
}
async leaveGroupV2(): Promise<void> {
const ourConversationId = window.ConversationController.getOurConversationId();
@ -4818,6 +4839,10 @@ export class ConversationModel extends window.Backbone.Model<
return false;
}
if (this.get('left')) {
return false;
}
return (
this.areWeAdmin() ||
this.get('accessControl')?.attributes ===