mirror of https://github.com/vector-im/riot-web
Add confirmation dialog for removing room from group
parent
0116c4b486
commit
6b834bc72e
|
@ -47,6 +47,22 @@ const GroupRoomTile = React.createClass({
|
||||||
return groupRoom.name || groupRoom.canonicalAlias || _t("Unnamed Room");
|
return groupRoom.name || groupRoom.canonicalAlias || _t("Unnamed Room");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
removeRoomFromGroup: function() {
|
||||||
|
const groupId = this.props.groupId;
|
||||||
|
const roomName = this.state.name;
|
||||||
|
const roomId = this.props.groupRoom.roomId;
|
||||||
|
this.context.matrixClient
|
||||||
|
.removeRoomFromGroup(groupId, roomId)
|
||||||
|
.catch((err) => {
|
||||||
|
console.error(`Error whilst removing ${roomId} from ${groupId}`, err);
|
||||||
|
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
|
||||||
|
Modal.createTrackedDialog('Failed to remove room from group', '', ErrorDialog, {
|
||||||
|
title: _t("Failed to remove room from group"),
|
||||||
|
description: _t("Failed to remove '%(roomName)s' from %(groupId)s", {groupId, roomName}),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
onClick: function(e) {
|
onClick: function(e) {
|
||||||
let roomId;
|
let roomId;
|
||||||
let roomAlias;
|
let roomAlias;
|
||||||
|
@ -63,21 +79,21 @@ const GroupRoomTile = React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
onDeleteClick: function(e) {
|
onDeleteClick: function(e) {
|
||||||
e.preventDefault();
|
|
||||||
e.stopPropagation();
|
|
||||||
const groupId = this.props.groupId;
|
const groupId = this.props.groupId;
|
||||||
const roomName = this.state.name;
|
const roomName = this.state.name;
|
||||||
const roomId = this.props.groupRoom.roomId;
|
e.preventDefault();
|
||||||
this.context.matrixClient
|
e.stopPropagation();
|
||||||
.removeRoomFromGroup(groupId, roomId)
|
const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
|
||||||
.catch((err) => {
|
Modal.createTrackedDialog('Confirm removal of group from room', '', QuestionDialog, {
|
||||||
console.error(`Error whilst removing ${roomId} from ${groupId}`, err);
|
title: _t("Are you sure you want to remove '%(roomName)s' from %(groupId)s?", {roomName, groupId}),
|
||||||
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
|
description: _t("Removing a room from the group will also remove it from the group page."),
|
||||||
Modal.createTrackedDialog('Failed to remove room from group', '', ErrorDialog, {
|
button: _t("Remove"),
|
||||||
title: _t("Failed to remove room from group"),
|
onFinished: (success) => {
|
||||||
description: _t("Failed to remove '%(roomName)s' from %(groupId)s", {groupId, roomName}),
|
if (success) {
|
||||||
});
|
this.removeRoomFromGroup();
|
||||||
});
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
|
|
|
@ -897,5 +897,7 @@
|
||||||
"Try using one of the following valid address types: %(validTypesList)s.": "Try using one of the following valid address types: %(validTypesList)s.",
|
"Try using one of the following valid address types: %(validTypesList)s.": "Try using one of the following valid address types: %(validTypesList)s.",
|
||||||
"You have entered an invalid address.": "You have entered an invalid address.",
|
"You have entered an invalid address.": "You have entered an invalid address.",
|
||||||
"Failed to remove room from group": "Failed to remove room from group",
|
"Failed to remove room from group": "Failed to remove room from group",
|
||||||
"Failed to remove '%(roomName)s' from %(groupId)s": "Failed to remove '%(roomName)s' from %(groupId)s"
|
"Failed to remove '%(roomName)s' from %(groupId)s": "Failed to remove '%(roomName)s' from %(groupId)s",
|
||||||
|
"Are you sure you want to remove '%(roomName)s' from %(groupId)s?": "Are you sure you want to remove '%(roomName)s' from %(groupId)s?",
|
||||||
|
"Removing a room from the group will also remove it from the group page.": "Removing a room from the group will also remove it from the group page."
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue