allow closed group updates from non-admin user

pull/1357/head
Audric Ackermann 5 years ago
parent 90bd30d0ac
commit e5db9916a5
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -270,7 +270,6 @@
};
};
const getGroupSettingsProps = () => {
const ourPK = window.textsecure.storage.user.getNumber();
const members = this.model.get('members') || [];
return {
@ -281,7 +280,7 @@
avatarPath: this.model.getAvatarPath(),
isGroup: !this.model.isPrivate(),
isPublic: this.model.isPublic(),
isAdmin: this.model.get('groupAdmins').includes(ourPK),
isAdmin: true, // allow closed group edits from anyone this.model.get('groupAdmins').includes(ourPK),
isRss: this.model.isRss(),
memberCount: members.length,
amMod: this.model.isModerator(

@ -21,9 +21,8 @@
this.members = groupConvo.get('members') || [];
this.avatarPath = groupConvo.getAvatarPath();
const ourPK = textsecure.storage.user.getNumber();
this.isAdmin = groupConvo.get('groupAdmins').includes(ourPK);
// any member can update a closed group name
this.isAdmin = true;
// public chat settings overrides
if (this.isPublic) {
@ -79,7 +78,6 @@
Whisper.UpdateGroupMembersDialogView = Whisper.View.extend({
className: 'loki-dialog modal',
initialize(groupConvo) {
const ourPK = textsecure.storage.user.getNumber();
this.groupName = groupConvo.get('name');
this.close = this.close.bind(this);
this.onSubmit = this.onSubmit.bind(this);
@ -99,7 +97,8 @@
this.existingMembers = [];
} else {
this.titleText = i18n('updateGroupDialogTitle', this.groupName);
this.isAdmin = groupConvo.get('groupAdmins').includes(ourPK);
// anybody can edit a closed group name or members
this.isAdmin = true;
const convos = window.getConversations().models.filter(d => !!d);
this.existingMembers = groupConvo.get('members') || [];

@ -245,7 +245,7 @@ class SessionGroupSettings extends React.Component<Props, any> {
const showUpdateGroupNameButton =
isPublic && !isKickedFromGroup
? amMod && !isBlocked
: isAdmin && !isBlocked;
: isAdmin && !isBlocked && !isKickedFromGroup;
const showUpdateGroupMembersButton =
!isPublic && !isKickedFromGroup && !isBlocked && isAdmin;

@ -85,9 +85,8 @@ export async function preprocessGroupMessage(
if (newGroup) {
conversation.updateGroupAdmins(group.admins);
} else {
// be sure to drop a message from a non admin if it tries to change group members
// or change the group name
const fromAdmin = conversation.get('groupAdmins').includes(primarySource);
// group members and names can be changed from any member
const fromAdmin = true;
if (!fromAdmin) {
// Make sure the message is not removing members / renaming the group

Loading…
Cancel
Save