From f7aa8be1c1792fdd265afd1acf1d5721af0cf567 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Wed, 16 Dec 2015 16:06:29 +0000 Subject: [PATCH] Add a forget button. Add left rooms to the "historical" tab. Call /forget when the forget button is clicked. Number of shortcomings: - We need to lazy load the historical list (atm we never get the list of left rooms; things only go into that list if you leave the room whilst running) - Once a room is forgotten we need to physically nuke it from the JS SDK. - Need icon for forget room. --- src/components/structures/RoomView.js | 23 ++++++++++++++++++++--- src/components/views/rooms/RoomHeader.js | 13 ++++++++++++- src/components/views/rooms/RoomList.js | 3 +++ 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 6db2659986..072742cf10 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -824,7 +824,14 @@ module.exports = React.createClass({ action: 'leave_room', room_id: this.props.roomId, }); - this.props.onFinished(); + }, + + onForgetClick: function() { + MatrixClientPeg.get().forget(this.props.roomId).done(function() { + dis.dispatch({ action: 'view_next_room' }); + }, function(err) { + console.error("Failed to forget room: %s", err); + }); }, onRejectButtonClicked: function(ev) { @@ -1249,8 +1256,18 @@ module.exports = React.createClass({ return (
- + { fileDropTarget }
diff --git a/src/components/views/rooms/RoomHeader.js b/src/components/views/rooms/RoomHeader.js index 068dff85d6..aaf570305c 100644 --- a/src/components/views/rooms/RoomHeader.js +++ b/src/components/views/rooms/RoomHeader.js @@ -129,7 +129,17 @@ module.exports = React.createClass({ if (this.props.onLeaveClick) { leave_button =
- Leave room + Leave room +
; + } + + var forget_button; + if (this.props.onForgetClick) { + forget_button = +
+ Forget room
; } @@ -147,6 +157,7 @@ module.exports = React.createClass({ {cancel_button} {save_button}
+ { forget_button } { leave_button }
Search diff --git a/src/components/views/rooms/RoomList.js b/src/components/views/rooms/RoomList.js index a89dd55f1a..c48ed5880f 100644 --- a/src/components/views/rooms/RoomList.js +++ b/src/components/views/rooms/RoomList.js @@ -168,6 +168,9 @@ module.exports = React.createClass({ if (me && me.membership == "invite") { s.lists["im.vector.fake.invite"].push(room); } + else if (me && (me.membership === "leave" || me.membership === "ban")) { + s.lists["im.vector.fake.archived"].push(room); + } else { var shouldShowRoom = ( me && (me.membership == "join")