diff --git a/src/components/views/elements/EditableItemList.js b/src/components/views/elements/EditableItemList.js index 1fdae69edd..66b5962426 100644 --- a/src/components/views/elements/EditableItemList.js +++ b/src/components/views/elements/EditableItemList.js @@ -58,28 +58,29 @@ export class EditableItem extends React.Component { this.setState({verifyRemove: false}); }; - render() {if (this.state.verifyRemove) { - return ( -
+ render() { + if (this.state.verifyRemove) { + return ( +
{_t("Are you sure?")} - - {_t("Yes")} - - - {_t("No")} - -
- ); - } + + {_t("Yes")} + + + {_t("No")} + +
+ ); + } return (
{_t("Remove")} + onClick={this._onRemove} className="mx_EditableItem_delete" alt={_t("Remove")}/> {this.props.value}
); @@ -99,6 +100,7 @@ export default class EditableItemList extends React.Component{ onNewItemChanged: PropTypes.func, canEdit: PropTypes.bool, + canRemove: PropTypes.bool, }; _onItemAdded = (e) => { @@ -133,6 +135,10 @@ export default class EditableItemList extends React.Component{ render() { const editableItems = this.props.items.map((item, index) => { + if (!this.props.canRemove) { + return
  • {item}
  • + } + return ; }); + const editableItemsSection = this.props.canRemove ? editableItems : ; const label = this.props.items.length > 0 ? this.props.itemsLabel : this.props.noItemsLabel; return (
    { label }
    - { editableItems } + { editableItemsSection } { this.props.canEdit ? this._renderNewItemField() :
    }
    ); } diff --git a/src/components/views/room_settings/AliasSettings.js b/src/components/views/room_settings/AliasSettings.js index 4859174b28..1e399ec01b 100644 --- a/src/components/views/room_settings/AliasSettings.js +++ b/src/components/views/room_settings/AliasSettings.js @@ -240,6 +240,7 @@ export default class AliasSettings extends React.Component { items={this.state.domainToAliases[localDomain] || []} newItem={this.state.newAlias} onNewItemChanged={this.onNewAliasChanged} + canRemove={this.props.canSetAliases} canEdit={this.props.canSetAliases} onItemAdded={this.onLocalAliasAdded} onItemRemoved={this.onLocalAliasDeleted} diff --git a/src/components/views/room_settings/RelatedGroupSettings.js b/src/components/views/room_settings/RelatedGroupSettings.js index 3381bdd0ff..64025b261e 100644 --- a/src/components/views/room_settings/RelatedGroupSettings.js +++ b/src/components/views/room_settings/RelatedGroupSettings.js @@ -107,6 +107,7 @@ export default class RelatedGroupSettings extends React.Component { items={this.state.newGroupsList} className={"mx_RelatedGroupSettings"} newItem={this.state.newGroupId} + canRemove={this.props.canSetRelatedGroups} canEdit={this.props.canSetRelatedGroups} onNewItemChanged={this.onNewGroupChanged} onItemAdded={this.onGroupAdded}