diff --git a/src/components/views/context_menus/RoomTagContextMenu.js b/src/components/views/context_menus/RoomTagContextMenu.js index 776f952272..3637a3a5ee 100644 --- a/src/components/views/context_menus/RoomTagContextMenu.js +++ b/src/components/views/context_menus/RoomTagContextMenu.js @@ -126,6 +126,25 @@ module.exports = React.createClass({ }; }, + _onClickForget: function() { + // FIXME: duplicated with RoomSettings (and dead code in RoomView) + MatrixClientPeg.get().forget(this.props.room.roomId).done(function() { + dis.dispatch({ action: 'view_next_room' }); + }, function(err) { + var errCode = err.errcode || "unknown error code"; + var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); + Modal.createDialog(ErrorDialog, { + title: "Error", + description: `Failed to forget room (${errCode})` + }); + }); + + // Close the context menu + if (this.props.onFinished) { + this.props.onFinished(); + }; + }, + render: function() { var myUserId = MatrixClientPeg.get().credentials.userId; var myMember = this.props.room.getMember(myUserId); @@ -148,6 +167,17 @@ module.exports = React.createClass({ 'mx_RoomTagContextMenu_fieldDisabled': false, }); + if (myMember && myMember.membership === "leave") { + return ( +
+
+ + Forget +
+
+ ); + } + return (