mirror of https://github.com/vector-im/riot-web
fix RoomTagContextMenu so it works on historical rooms
parent
13983900c0
commit
ee1fae8ced
|
@ -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() {
|
render: function() {
|
||||||
var myUserId = MatrixClientPeg.get().credentials.userId;
|
var myUserId = MatrixClientPeg.get().credentials.userId;
|
||||||
var myMember = this.props.room.getMember(myUserId);
|
var myMember = this.props.room.getMember(myUserId);
|
||||||
|
@ -148,6 +167,17 @@ module.exports = React.createClass({
|
||||||
'mx_RoomTagContextMenu_fieldDisabled': false,
|
'mx_RoomTagContextMenu_fieldDisabled': false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (myMember && myMember.membership === "leave") {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<div className={ leaveClasses } onClick={ this._onClickForget } >
|
||||||
|
<img className="mx_RoomTagContextMenu_icon" src="img/icon_context_delete.svg" width="15" height="15" />
|
||||||
|
Forget
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div className={ favouriteClasses } onClick={this._onClickFavourite} >
|
<div className={ favouriteClasses } onClick={this._onClickFavourite} >
|
||||||
|
|
Loading…
Reference in New Issue