"Leave {Closed|Open} Group" button depending on group opened

This commit is contained in:
Audric Ackermann 2020-01-23 15:31:12 +11:00
parent aeaa3b9e5d
commit d13efafad2
No known key found for this signature in database
GPG key ID: 999F434D76324AD4
3 changed files with 14 additions and 4 deletions

View file

@ -2110,6 +2110,14 @@
"message": "Leave Group",
"description": "Button action that the user can click to leave the group"
},
"leaveOpenGroup": {
"message": "Leave Open Group",
"description": "Button action that the user can click to leave the group"
},
"leaveClosedGroup": {
"message": "Leave Closed Group",
"description": "Button action that the user can click to leave the group"
},
"leaveGroupDialogTitle": {
"message": "Are you sure you want to leave this group?",
"description":
@ -2226,7 +2234,7 @@
"message": "Server URL",
"description": "Placeholder for server URL input"
},
"noServerUrl": {
"noServerURL": {
"message": "Please enter a server URL",
"description": "Error message when no server url entered"
},

View file

@ -224,7 +224,7 @@
},
showCreateGroup() {
// TODO: make it impossible to open 2 dialogs as once
// Curretnly, if the button is in focus, it is possible to
// Currently, if the button is in focus, it is possible to
// create a new dialog by pressing 'Enter'
const dialog = new Whisper.CreateGroupDialogView();
this.el.append(dialog.el);

View file

@ -17,6 +17,7 @@ interface Props {
description: string;
avatarPath: string;
timerOptions: Array<TimerOption>;
isPublic: boolean;
onGoBack: () => void;
onInviteFriends: () => void;
@ -183,9 +184,10 @@ export class SessionChannelSettings extends React.Component<Props, any> {
}
public render() {
const { memberCount, name, onLeaveGroup } = this.props;
const { memberCount, name, onLeaveGroup, isPublic } = this.props;
const { documents, media, onItemClick } = this.state;
const showMemberCount = !!(memberCount && memberCount > 0);
const leaveGroupString = isPublic ? window.i18n('leaveOpenGroup') : window.i18n('leaveClosedGroup');
return (
<div className="group-settings">
@ -213,7 +215,7 @@ export class SessionChannelSettings extends React.Component<Props, any> {
onItemClick={onItemClick}
/>
<SessionButton
text={window.i18n('leaveGroup')}
text={leaveGroupString}
buttonColor={SessionButtonColor.Danger}
buttonType={SessionButtonType.SquareOutline}
onClick={onLeaveGroup}