From 790085bea1a118472f927e382231f2d09e34cc6a Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Wed, 19 Feb 2020 16:21:52 +1100 Subject: [PATCH] disable profile image upload for closed group --- _locales/en/messages.json | 8 ++- js/background.js | 4 +- .../conversation/UpdateGroupNameDialog.tsx | 72 +++++++++---------- .../session/SessionGroupSettings.tsx | 2 +- 4 files changed, 45 insertions(+), 41 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 03ff620bb..a7e6d2766 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -2204,9 +2204,13 @@ "message": "Edit Profile", "description": "Button action that the user can click to edit their profile" }, - "editGroupName": { + "editGroupNameOrPicture": { "message": "Edit group name or picture", - "description": "Button action that the user can click to edit a group name" + "description": "Button action that the user can click to edit a group name (open)" + }, + "editGroupName": { + "message": "Edit group name", + "description": "Button action that the user can click to edit a group name (closed)" }, "createGroupDialogTitle": { "message": "Creating a Closed Group", diff --git a/js/background.js b/js/background.js index 5478fbffc..bd3ced3d5 100644 --- a/js/background.js +++ b/js/background.js @@ -754,7 +754,7 @@ const fileObj = await API.serverAPI.putAttachment(attachment.data); if (fileObj === null) { // problem - log.warn('File upload failed'); + window.warn('File upload failed'); return; } @@ -764,7 +764,7 @@ '' ); // write it to the channel - const changeRes = await API.setChannelAvatar(relativeFileUrl); + await API.setChannelAvatar(relativeFileUrl); } if (await API.setChannelName(groupName)) { diff --git a/ts/components/conversation/UpdateGroupNameDialog.tsx b/ts/components/conversation/UpdateGroupNameDialog.tsx index 53fcf648e..1f0d033ff 100644 --- a/ts/components/conversation/UpdateGroupNameDialog.tsx +++ b/ts/components/conversation/UpdateGroupNameDialog.tsx @@ -72,10 +72,6 @@ export class UpdateGroupNameDialog extends React.Component { const { okText, cancelText } = this.props; const titleText = `${this.props.titleText}`; - let noAvatarClasses; - - noAvatarClasses = classNames('avatar-center'); - const errorMsg = this.state.errorMessage; const errorMessageClasses = classNames( @@ -93,32 +89,7 @@ export class UpdateGroupNameDialog extends React.Component {

{errorMsg}

- -
-
- {this.renderAvatar()} -
- -
{ - const el = this.inputEl.current; - if (el) { - el.click(); - } - }} - /> -
-
-
+ {this.renderAvatar()}
{ private renderAvatar() { const avatarPath = this.state.avatar; + const isPublic = this.props.isPublic; + + if (!isPublic) { + return undefined; + } return ( - +
+
+ +
+ +
{ + const el = this.inputEl.current; + if (el) { + el.click(); + } + }} + /> +
+
+
); } diff --git a/ts/components/session/SessionGroupSettings.tsx b/ts/components/session/SessionGroupSettings.tsx index cff0c7245..c5f50bef7 100644 --- a/ts/components/session/SessionGroupSettings.tsx +++ b/ts/components/session/SessionGroupSettings.tsx @@ -256,7 +256,7 @@ export class SessionGroupSettings extends React.Component { role="button" onClick={this.props.onUpdateGroupName} > - {window.i18n('editGroupName')} + {isPublic ? window.i18n('editGroupNameOrPicture') : window.i18n('editGroupName')}
)} {showUpdateGroupMembersButton && (