Merge pull request #859 from Bilb/various-group-updates-fixes

Various group updates fixes
pull/869/head
Vince 6 years ago committed by GitHub
commit fbf82efb6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2488,9 +2488,6 @@
"message": "Profile name cannot be empty", "message": "Profile name cannot be empty",
"description": "Error message displayed on empty profile name" "description": "Error message displayed on empty profile name"
}, },
"maxGroupMembersError": {
"message": "Max number of members for small group chats is: "
},
"nonAdminDeleteMember": { "nonAdminDeleteMember": {
"message": "Only group admin can remove members!" "message": "Only group admin can remove members!"
}, },
@ -2799,5 +2796,34 @@
}, },
"devicePairedSuccessfully": { "devicePairedSuccessfully": {
"message": "Device linked successfully" "message": "Device linked successfully"
},
"invalidGroupName": {
"message": "Group Name length must be between 1 to $maxSize$",
"description": "Error message displayed on invalid group name",
"placeholders": {
"maxSize": {
"content": "$1",
"example": "125"
}
}
},
"invalidGroupSize": {
"message": "Closed Group size must be between 1 to $maxSize$",
"description": "Error message displayed on invalid closed group size",
"placeholders": {
"maxSize": {
"content": "$1",
"example": "10"
}
}
},
"maxGroupMembersError": {
"message": "Max number of members for small group chats is $maxSize$",
"placeholders": {
"maxSize": {
"content": "$1",
"example": "10"
}
}
} }
} }

@ -72,11 +72,9 @@
// Do not trigger an update if there is too many members // Do not trigger an update if there is too many members
if ( if (
newMembers.length + existingMembers.length > newMembers.length + existingMembers.length >
window.SMALL_GROUP_SIZE_LIMIT window.CONSTANTS.SMALL_GROUP_SIZE_LIMIT
) { ) {
const msg = `${window.i18n('maxGroupMembersError')} ${ const msg = window.i18n('maxGroupMembersError', window.CONSTANTS.SMALL_GROUP_SIZE_LIMIT);
window.SMALL_GROUP_SIZE_LIMIT
}`;
window.pushToast({ window.pushToast({
title: msg, title: msg,

@ -202,17 +202,6 @@ export class UpdateGroupMembersDialog extends React.Component<Props, State> {
} }
}); });
const newMemberCount = this.getMemberCount(updatedFriends);
if (newMemberCount > window.CONSTANTS.SMALL_GROUP_SIZE_LIMIT) {
const msg = `${this.props.i18n('maxGroupMembersError')} ${
window.CONSTANTS.SMALL_GROUP_SIZE_LIMIT
}`;
this.onShowError(msg);
return;
}
this.setState(state => { this.setState(state => {
return { return {
...state, ...state,

@ -399,11 +399,28 @@ export class LeftPaneChannelSection extends React.Component<Props, State> {
groupMembers: Array<ContactType> groupMembers: Array<ContactType>
) { ) {
// Validate groupName and groupMembers length // Validate groupName and groupMembers length
if (groupName.length === 0 ||
groupName.length > window.CONSTANTS.MAX_GROUP_NAME_LENGTH) {
window.pushToast({
title: window.i18n('invalidGroupName', window.CONSTANTS.MAX_GROUP_NAME_LENGTH),
type: 'error',
id: 'invalidGroupName',
});
return;
}
// >= because we add ourself as a member after this. so a 10 group is already invalid as it will be 11 with ourself
if ( if (
groupMembers.length === 0 || groupMembers.length === 0 ||
groupName.length === 0 || groupMembers.length >= window.CONSTANTS.SMALL_GROUP_SIZE_LIMIT
groupName.length > window.CONSTANTS.MAX_GROUP_NAME_LENGTH
) { ) {
window.pushToast({
title: window.i18n('invalidGroupSize', window.CONSTANTS.SMALL_GROUP_SIZE_LIMIT),
type: 'error',
id: 'invalidGroupSize',
});
return; return;
} }

Loading…
Cancel
Save