Don't perform admin check if it's a new group that we are creating

pull/877/head
Mikunj 6 years ago
parent fc6ca57e1e
commit 62825faa61

@ -1946,38 +1946,38 @@
conversation.setFriendRequestStatus( conversation.setFriendRequestStatus(
window.friends.friendRequestStatusEnum.friends window.friends.friendRequestStatusEnum.friends
); );
} } else {
const fromAdmin = conversation
const fromAdmin = conversation .get('groupAdmins')
.get('groupAdmins') .includes(primarySource);
.includes(primarySource);
if (!fromAdmin) {
if (!fromAdmin) { // Make sure the message is not removing members / renaming the group
// Make sure the message is not removing members / renaming the group const nameChanged =
const nameChanged = conversation.get('name') !== initialMessage.group.name;
conversation.get('name') !== initialMessage.group.name;
if (nameChanged) {
if (nameChanged) { window.log.warn(
window.log.warn( 'Non-admin attempts to change the name of the group'
'Non-admin attempts to change the name of the group' );
); }
}
const membersMissing = const membersMissing =
_.difference( _.difference(
conversation.get('members'), conversation.get('members'),
initialMessage.group.members initialMessage.group.members
).length > 0; ).length > 0;
if (membersMissing) { if (membersMissing) {
window.log.warn('Non-admin attempts to remove group members'); window.log.warn('Non-admin attempts to remove group members');
} }
const messageAllowed = !nameChanged && !membersMissing; const messageAllowed = !nameChanged && !membersMissing;
if (!messageAllowed) { if (!messageAllowed) {
confirm(); confirm();
return null; return null;
}
} }
} }
// For every member, see if we need to establish a session: // For every member, see if we need to establish a session:

Loading…
Cancel
Save