Skip to content

Commit

Permalink
[FIX] Unarchive permission not honored (#3237)
Browse files Browse the repository at this point in the history
* [FIX] Show alert when unarchive error

* Title in alert

* Disable button when the user donesn't have the role permission

* Use ARCHIVE/UNARCHIVE instead of their lowercase in alert and removed capitalize lodash

* Check if the error eis translated before parse through i18n

* Remove unnecessary code

Co-authored-by: Diego Mello <diegolmello@gmail.com>
Co-authored-by: Levy Costa <levycosta471@gmail.com>
  • Loading branch information
3 people committed Aug 16, 2021
1 parent 49f936b commit 1c43c78
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions app/views/RoomInfoEditView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -415,11 +415,6 @@ class RoomInfoEditView extends React.Component {
return permissions[PERMISSION_DELETE_C];
}

hasArchivePermission = () => {
const { permissions } = this.state;
return (permissions[PERMISSION_ARCHIVE] || permissions[PERMISSION_UNARCHIVE]);
};

renderSystemMessages = () => {
const { systemMessages, enableSysMes } = this.state;
const { theme } = this.props;
Expand Down Expand Up @@ -691,11 +686,11 @@ class RoomInfoEditView extends React.Component {
style={[
styles.buttonInverted,
styles.buttonContainer_inverted,
!this.hasArchivePermission() && sharedStyles.opacity5,
archived ? !permissions[PERMISSION_UNARCHIVE] && sharedStyles.opacity5 : !permissions[PERMISSION_ARCHIVE] && sharedStyles.opacity5,
{ flex: 1, marginLeft: 10, borderColor: dangerColor }
]}
onPress={this.toggleArchive}
disabled={!this.hasArchivePermission()}
disabled={archived ? !permissions[PERMISSION_UNARCHIVE] : !permissions[PERMISSION_ARCHIVE]}
testID={archived ? 'room-info-edit-view-unarchive' : 'room-info-edit-view-archive'}
>
<Text
Expand Down

0 comments on commit 1c43c78

Please sign in to comment.