Implemented ability to quickly add a user to a group

This commit is contained in:
Alvaro 2022-09-26 10:24:52 -06:00 committed by GitHub
parent 190cd9408b
commit 22bf3ebcc0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 855 additions and 70 deletions

View file

@ -1850,6 +1850,7 @@ export class ConversationModel extends window.Backbone
badges: this.get('badges') || [],
canChangeTimer: this.canChangeTimer(),
canEditGroupInfo: this.canEditGroupInfo(),
canAddNewMembers: this.canAddNewMembers(),
avatarPath: this.getAbsoluteAvatarPath(),
avatarHash: this.getAvatarHash(),
unblurredAvatarPath: this.getAbsoluteUnblurredAvatarPath(),
@ -5111,6 +5112,22 @@ export class ConversationModel extends window.Backbone
);
}
canAddNewMembers(): boolean {
if (!isGroupV2(this.attributes)) {
return false;
}
if (this.get('left')) {
return false;
}
return (
this.areWeAdmin() ||
this.get('accessControl')?.members ===
Proto.AccessControl.AccessRequired.MEMBER
);
}
areWeAdmin(): boolean {
if (!isGroupV2(this.attributes)) {
return false;