diff --git a/src/components/structures/GroupView.js b/src/components/structures/GroupView.js
index 422b822df3..f00dc59e0b 100644
--- a/src/components/structures/GroupView.js
+++ b/src/components/structures/GroupView.js
@@ -111,7 +111,11 @@ const CategoryRoomList = React.createClass({
) :
;
const roomNodes = this.props.rooms.map((r) => {
- return ;
+ return ;
});
let catHeader = ;
@@ -131,6 +135,8 @@ const FeaturedRoom = React.createClass({
props: {
summaryInfo: RoomSummaryType.isRequired,
+ editing: PropTypes.bool.isRequired,
+ groupId: PropTypes.string.isRequired,
},
onClick: function(e) {
@@ -144,6 +150,31 @@ const FeaturedRoom = React.createClass({
});
},
+ onDeleteClicked: function(e) {
+ e.preventDefault();
+ e.stopPropagation();
+ MatrixClientPeg.get().removeRoomFromGroupSummary(
+ this.props.groupId,
+ this.props.summaryInfo.room_id,
+ ).catch((err) => {
+ console.error('Error whilst removing room from group summary', err);
+ const roomName = this.props.summaryInfo.name ||
+ this.props.summaryInfo.canonical_alias ||
+ this.props.summaryInfo.room_id;
+ const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
+ Modal.createTrackedDialog(
+ 'Failed to remove room from group summary',
+ '', ErrorDialog,
+ {
+ title: _t(
+ "Failed to remove the room from the summary of %(groupId)s",
+ {groupId: this.props.groupId},
+ ),
+ description: _t("The room '%(roomName)s' could not be removed from the summary.", {roomName}),
+ });
+ });
+ },
+
render: function() {
const RoomAvatar = sdk.getComponent("avatars.RoomAvatar");
@@ -163,9 +194,20 @@ const FeaturedRoom = React.createClass({
roomNameNode = {this.props.summaryInfo.profile.name};
}
+ const deleteButton = this.props.editing ?
+
+ : ;
+
return
{roomNameNode}
+ {deleteButton}
;
},
});
@@ -234,7 +276,11 @@ const RoleUserList = React.createClass({
) : ;
const userNodes = this.props.users.map((u) => {
- return ;
+ return ;
});
let roleHeader = ;
if (this.props.role && this.props.role.profile) {
@@ -253,6 +299,8 @@ const FeaturedUser = React.createClass({
props: {
summaryInfo: UserSummaryType.isRequired,
+ editing: PropTypes.bool.isRequired,
+ groupId: PropTypes.string.isRequired,
},
onClick: function(e) {
@@ -266,6 +314,29 @@ const FeaturedUser = React.createClass({
});
},
+ onDeleteClicked: function(e) {
+ e.preventDefault();
+ e.stopPropagation();
+ MatrixClientPeg.get().removeUserFromGroupSummary(
+ this.props.groupId,
+ this.props.summaryInfo.user_id,
+ ).catch((err) => {
+ console.error('Error whilst removing user from group summary', err);
+ const displayName = this.props.summaryInfo.displayname || this.props.summaryInfo.user_id;
+ const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
+ Modal.createTrackedDialog(
+ 'Failed to remove user from group summary',
+ '', ErrorDialog,
+ {
+ title: _t(
+ "Failed to remove a user from the summary of %(groupId)s",
+ {groupId: this.props.groupId},
+ ),
+ description: _t("The user '%(displayName)s' could not be removed from the summary.", {displayName}),
+ });
+ });
+ },
+
render: function() {
const BaseAvatar = sdk.getComponent("avatars.BaseAvatar");
const name = this.props.summaryInfo.displayname || this.props.summaryInfo.user_id;
@@ -275,9 +346,20 @@ const FeaturedUser = React.createClass({
const httpUrl = MatrixClientPeg.get()
.mxcUrlToHttp(this.props.summaryInfo.avatar_url, 64, 64);
+ const deleteButton = this.props.editing ?
+
+ : ;
+
return
{userNameNode}
+ {deleteButton}
;
},
});
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json
index 9c7318eb60..e894987052 100644
--- a/src/i18n/strings/en_EN.json
+++ b/src/i18n/strings/en_EN.json
@@ -896,5 +896,9 @@
"Add rooms to the group summary": "Add rooms to the group summary",
"Which rooms would you like to add to this summary?": "Which rooms would you like to add to this summary?",
"Room name or alias": "Room name or alias",
- "You are an administrator of this group": "You are an administrator of this group"
+ "You are an administrator of this group": "You are an administrator of this group",
+ "Failed to remove the room from the summary of %(groupId)s": "Failed to remove the room from the summary of %(groupId)s",
+ "The room '%(roomName)' could not be removed from the summary.": "The room '%(roomName)' could not be removed from the summary."
+ "Failed to remove a user from the summary of %(groupId)s": "Failed to remove a user from the summary of %(groupId)s",
+ "The user '%(displayName)s' could not be removed from the summary.": "The user '%(displayName)s' could not be removed from the summary."
}