2015-11-30 16:55:00 +00:00
|
|
|
/*
|
2016-01-07 04:06:39 +00:00
|
|
|
Copyright 2015, 2016 OpenMarket Ltd
|
2015-11-30 16:55:00 +00:00
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
var React = require("react");
|
|
|
|
var ReactDOM = require("react-dom");
|
|
|
|
var GeminiScrollbar = require('react-gemini-scrollbar');
|
|
|
|
var MatrixClientPeg = require("../../../MatrixClientPeg");
|
2015-12-17 02:49:09 +00:00
|
|
|
var CallHandler = require('../../../CallHandler');
|
2015-11-30 16:55:00 +00:00
|
|
|
var RoomListSorter = require("../../../RoomListSorter");
|
|
|
|
var dis = require("../../../dispatcher");
|
|
|
|
var sdk = require('../../../index');
|
2016-02-04 18:06:24 +00:00
|
|
|
var rate_limited_func = require('../../../ratelimitedfunc');
|
2016-09-07 10:33:58 +00:00
|
|
|
var Rooms = require('../../../Rooms');
|
2016-10-02 11:57:45 +00:00
|
|
|
import DMRoomMap from '../../../utils/DMRoomMap';
|
2016-09-09 15:59:59 +00:00
|
|
|
var Receipt = require('../../../utils/Receipt');
|
2017-04-17 19:58:43 +00:00
|
|
|
var constantTimeDispatcher = require('../../../ConstantTimeDispatcher');
|
2015-11-30 16:55:00 +00:00
|
|
|
|
|
|
|
var HIDE_CONFERENCE_CHANS = true;
|
|
|
|
|
|
|
|
module.exports = React.createClass({
|
|
|
|
displayName: 'RoomList',
|
|
|
|
|
|
|
|
propTypes: {
|
2015-12-01 16:29:58 +00:00
|
|
|
ConferenceHandler: React.PropTypes.any,
|
2016-08-09 22:57:36 +00:00
|
|
|
collapsed: React.PropTypes.bool.isRequired,
|
2017-04-18 18:28:24 +00:00
|
|
|
selectedRoom: React.PropTypes.string,
|
2016-04-15 16:55:00 +00:00
|
|
|
searchFilter: React.PropTypes.string,
|
2015-11-30 16:55:00 +00:00
|
|
|
},
|
|
|
|
|
2017-04-20 00:12:57 +00:00
|
|
|
shouldComponentUpdate: function(nextProps, nextState) {
|
|
|
|
if (nextProps.collapsed !== this.props.collapsed) return true;
|
|
|
|
if (nextProps.searchFilter !== this.props.searchFilter) return true;
|
2017-04-21 11:40:13 +00:00
|
|
|
if (nextState.lists !== this.state.lists ||
|
|
|
|
nextState.isLoadingLeftRooms !== this.state.isLoadingLeftRooms ||
|
|
|
|
nextState.incomingCall !== this.state.incomingCall) return true;
|
2017-04-20 00:12:57 +00:00
|
|
|
return false;
|
|
|
|
},
|
|
|
|
|
2015-11-30 16:55:00 +00:00
|
|
|
getInitialState: function() {
|
|
|
|
return {
|
2015-12-18 15:13:59 +00:00
|
|
|
isLoadingLeftRooms: false,
|
2015-11-30 16:55:00 +00:00
|
|
|
lists: {},
|
2015-12-17 02:49:09 +00:00
|
|
|
incomingCall: null,
|
2017-01-20 14:22:27 +00:00
|
|
|
};
|
2015-11-30 16:55:00 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
componentWillMount: function() {
|
|
|
|
var cli = MatrixClientPeg.get();
|
|
|
|
cli.on("Room", this.onRoom);
|
2015-12-16 16:27:46 +00:00
|
|
|
cli.on("deleteRoom", this.onDeleteRoom);
|
2015-11-30 16:55:00 +00:00
|
|
|
cli.on("Room.timeline", this.onRoomTimeline);
|
|
|
|
cli.on("Room.name", this.onRoomName);
|
|
|
|
cli.on("Room.tags", this.onRoomTags);
|
2017-04-18 21:36:54 +00:00
|
|
|
cli.on("Room.receipt", this.onRoomReceipt);
|
2017-04-18 22:29:28 +00:00
|
|
|
cli.on("RoomState.members", this.onRoomStateMember);
|
2015-11-30 16:55:00 +00:00
|
|
|
cli.on("RoomMember.name", this.onRoomMemberName);
|
2016-09-07 16:46:45 +00:00
|
|
|
cli.on("accountData", this.onAccountData);
|
2015-11-30 16:55:00 +00:00
|
|
|
|
2017-04-17 19:58:43 +00:00
|
|
|
// lookup for which lists a given roomId is currently in.
|
|
|
|
this.listsForRoomId = {};
|
|
|
|
|
2017-04-18 18:28:24 +00:00
|
|
|
var s = this.getRoomLists();
|
|
|
|
this.setState(s);
|
|
|
|
|
2017-04-18 01:43:29 +00:00
|
|
|
// order of the sublists
|
2017-04-20 12:53:36 +00:00
|
|
|
//this.listOrder = [];
|
|
|
|
|
|
|
|
// loop count to stop a stack overflow if the user keeps waggling the
|
|
|
|
// mouse for >30s in a row, or if running under mocha
|
|
|
|
this._delayedRefreshRoomListLoopCount = 0
|
2015-11-30 16:55:00 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
componentDidMount: function() {
|
|
|
|
this.dispatcherRef = dis.register(this.onAction);
|
2016-08-30 11:29:25 +00:00
|
|
|
// Initialise the stickyHeaders when the component is created
|
2016-08-26 14:09:13 +00:00
|
|
|
this._updateStickyHeaders(true);
|
2015-11-30 16:55:00 +00:00
|
|
|
},
|
|
|
|
|
2017-04-18 18:28:24 +00:00
|
|
|
componentWillReceiveProps: function(nextProps) {
|
|
|
|
// short-circuit react when the room changes
|
|
|
|
// to avoid rerendering all the sublists everywhere
|
|
|
|
if (nextProps.selectedRoom !== this.props.selectedRoom) {
|
|
|
|
if (this.props.selectedRoom) {
|
|
|
|
constantTimeDispatcher.dispatch(
|
|
|
|
"RoomTile.select", this.props.selectedRoom, {}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
constantTimeDispatcher.dispatch(
|
|
|
|
"RoomTile.select", nextProps.selectedRoom, { selected: true }
|
|
|
|
);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2017-04-20 00:12:57 +00:00
|
|
|
componentDidUpdate: function(prevProps, prevState) {
|
2016-08-30 11:29:25 +00:00
|
|
|
// Reinitialise the stickyHeaders when the component is updated
|
2016-08-26 14:09:13 +00:00
|
|
|
this._updateStickyHeaders(true);
|
2016-09-15 14:33:08 +00:00
|
|
|
this._repositionIncomingCallBox(undefined, false);
|
2016-08-25 18:46:01 +00:00
|
|
|
},
|
|
|
|
|
2015-11-30 16:55:00 +00:00
|
|
|
onAction: function(payload) {
|
|
|
|
switch (payload.action) {
|
|
|
|
case 'view_tooltip':
|
|
|
|
this.tooltip = payload.tooltip;
|
2015-12-17 02:49:09 +00:00
|
|
|
break;
|
|
|
|
case 'call_state':
|
|
|
|
var call = CallHandler.getCall(payload.room_id);
|
|
|
|
if (call && call.call_state === 'ringing') {
|
|
|
|
this.setState({
|
|
|
|
incomingCall: call
|
|
|
|
});
|
|
|
|
this._repositionIncomingCallBox(undefined, true);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
this.setState({
|
|
|
|
incomingCall: null
|
2016-04-15 16:55:00 +00:00
|
|
|
});
|
2015-12-17 02:49:09 +00:00
|
|
|
}
|
|
|
|
break;
|
2017-03-28 09:38:57 +00:00
|
|
|
case 'on_room_read':
|
2017-04-17 19:58:43 +00:00
|
|
|
// poke the right RoomTile to refresh, using the constantTimeDispatcher
|
|
|
|
// to avoid each and every RoomTile registering to the 'on_room_read' event
|
|
|
|
// XXX: if we like the constantTimeDispatcher we might want to dispatch
|
|
|
|
// directly from TimelinePanel rather than needlessly bouncing via here.
|
|
|
|
constantTimeDispatcher.dispatch(
|
|
|
|
"RoomTile.refresh", payload.room.roomId, {}
|
|
|
|
);
|
2017-04-18 18:28:24 +00:00
|
|
|
|
|
|
|
// also have to poke the right list(s)
|
|
|
|
var lists = this.listsForRoomId[payload.room.roomId];
|
|
|
|
if (lists) {
|
|
|
|
lists.forEach(list=>{
|
|
|
|
constantTimeDispatcher.dispatch(
|
|
|
|
"RoomSubList.refreshHeader", list, { room: payload.room }
|
|
|
|
);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-03-28 09:38:57 +00:00
|
|
|
break;
|
2015-11-30 16:55:00 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
componentWillUnmount: function() {
|
|
|
|
dis.unregister(this.dispatcherRef);
|
|
|
|
if (MatrixClientPeg.get()) {
|
|
|
|
MatrixClientPeg.get().removeListener("Room", this.onRoom);
|
2016-02-04 15:55:24 +00:00
|
|
|
MatrixClientPeg.get().removeListener("deleteRoom", this.onDeleteRoom);
|
2015-11-30 16:55:00 +00:00
|
|
|
MatrixClientPeg.get().removeListener("Room.timeline", this.onRoomTimeline);
|
|
|
|
MatrixClientPeg.get().removeListener("Room.name", this.onRoomName);
|
2016-02-04 15:55:24 +00:00
|
|
|
MatrixClientPeg.get().removeListener("Room.tags", this.onRoomTags);
|
2017-04-18 21:36:54 +00:00
|
|
|
MatrixClientPeg.get().removeListener("Room.receipt", this.onRoomReceipt);
|
2017-04-18 22:29:28 +00:00
|
|
|
MatrixClientPeg.get().removeListener("RoomState.members", this.onRoomStateMember);
|
2016-02-04 15:55:24 +00:00
|
|
|
MatrixClientPeg.get().removeListener("RoomMember.name", this.onRoomMemberName);
|
2016-09-07 16:46:45 +00:00
|
|
|
MatrixClientPeg.get().removeListener("accountData", this.onAccountData);
|
2015-11-30 16:55:00 +00:00
|
|
|
}
|
2016-08-10 12:39:47 +00:00
|
|
|
// cancel any pending calls to the rate_limited_funcs
|
|
|
|
this._delayedRefreshRoomList.cancelPendingCall();
|
2015-11-30 16:55:00 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
onRoom: function(room) {
|
2017-04-17 19:58:43 +00:00
|
|
|
// XXX: this happens rarely; ideally we should only update the correct
|
|
|
|
// sublists when it does (e.g. via a constantTimeDispatch to the right sublist)
|
2015-12-18 15:13:59 +00:00
|
|
|
this._delayedRefreshRoomList();
|
2015-11-30 16:55:00 +00:00
|
|
|
},
|
|
|
|
|
2015-12-16 16:27:46 +00:00
|
|
|
onDeleteRoom: function(roomId) {
|
2017-04-17 19:58:43 +00:00
|
|
|
// XXX: this happens rarely; ideally we should only update the correct
|
|
|
|
// sublists when it does (e.g. via a constantTimeDispatch to the right sublist)
|
2015-12-18 15:13:59 +00:00
|
|
|
this._delayedRefreshRoomList();
|
2015-12-16 16:27:46 +00:00
|
|
|
},
|
|
|
|
|
2016-08-30 10:55:51 +00:00
|
|
|
onArchivedHeaderClick: function(isHidden, scrollToPosition) {
|
2015-12-18 11:55:43 +00:00
|
|
|
if (!isHidden) {
|
2015-12-18 15:13:59 +00:00
|
|
|
var self = this;
|
|
|
|
this.setState({ isLoadingLeftRooms: true });
|
2016-08-30 10:55:51 +00:00
|
|
|
|
|
|
|
// Try scrolling to position
|
|
|
|
this._updateStickyHeaders(true, scrollToPosition);
|
|
|
|
|
2015-12-18 11:55:43 +00:00
|
|
|
// we don't care about the response since it comes down via "Room"
|
|
|
|
// events.
|
|
|
|
MatrixClientPeg.get().syncLeftRooms().catch(function(err) {
|
|
|
|
console.error("Failed to sync left rooms: %s", err);
|
|
|
|
console.error(err);
|
2015-12-18 15:13:59 +00:00
|
|
|
}).finally(function() {
|
|
|
|
self.setState({ isLoadingLeftRooms: false });
|
2015-12-18 11:55:43 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2017-04-15 12:23:52 +00:00
|
|
|
_onMouseOver: function(ev) {
|
|
|
|
this._lastMouseOverTs = Date.now();
|
|
|
|
},
|
|
|
|
|
2016-08-26 14:09:13 +00:00
|
|
|
onSubListHeaderClick: function(isHidden, scrollToPosition) {
|
2016-08-26 08:56:07 +00:00
|
|
|
// The scroll area has expanded or contracted, so re-calculate sticky headers positions
|
2016-08-26 14:09:13 +00:00
|
|
|
this._updateStickyHeaders(true, scrollToPosition);
|
2016-08-26 08:56:07 +00:00
|
|
|
},
|
|
|
|
|
2016-09-08 21:48:44 +00:00
|
|
|
onRoomTimeline: function(ev, room, toStartOfTimeline, removed, data) {
|
2015-11-30 16:55:00 +00:00
|
|
|
if (toStartOfTimeline) return;
|
2016-09-09 01:28:14 +00:00
|
|
|
if (!room) return;
|
2016-09-08 21:48:44 +00:00
|
|
|
if (data.timeline.getTimelineSet() !== room.getUnfilteredTimelineSet()) return;
|
2017-04-17 19:58:43 +00:00
|
|
|
|
|
|
|
// rather than regenerate our full roomlists, which is very heavy, we poke the
|
|
|
|
// correct sublists to just re-sort themselves. This isn't enormously reacty,
|
|
|
|
// but is much faster than the default react reconciler, or having to do voodoo
|
|
|
|
// with shouldComponentUpdate and a pleaseRefresh property or similar.
|
2017-04-18 01:43:29 +00:00
|
|
|
var lists = this.listsForRoomId[room.roomId];
|
2017-04-17 19:58:43 +00:00
|
|
|
if (lists) {
|
|
|
|
lists.forEach(list=>{
|
|
|
|
constantTimeDispatcher.dispatch("RoomSubList.sort", list, { room: room });
|
|
|
|
});
|
|
|
|
}
|
2017-04-18 21:36:54 +00:00
|
|
|
|
|
|
|
// we have to explicitly hit the roomtile which just changed
|
|
|
|
constantTimeDispatcher.dispatch(
|
|
|
|
"RoomTile.refresh", room.roomId, {}
|
|
|
|
);
|
2015-11-30 16:55:00 +00:00
|
|
|
},
|
|
|
|
|
2015-12-18 17:51:17 +00:00
|
|
|
onRoomReceipt: function(receiptEvent, room) {
|
|
|
|
// because if we read a notification, it will affect notification count
|
2016-01-07 10:38:44 +00:00
|
|
|
// only bother updating if there's a receipt from us
|
2016-09-09 15:59:59 +00:00
|
|
|
if (Receipt.findReadReceiptFromUserId(receiptEvent, MatrixClientPeg.get().credentials.userId)) {
|
2017-04-18 01:43:29 +00:00
|
|
|
var lists = this.listsForRoomId[room.roomId];
|
2017-04-17 19:58:43 +00:00
|
|
|
if (lists) {
|
|
|
|
lists.forEach(list=>{
|
|
|
|
constantTimeDispatcher.dispatch(
|
|
|
|
"RoomSubList.refreshHeader", list, { room: room }
|
|
|
|
);
|
|
|
|
});
|
|
|
|
}
|
2017-04-18 21:36:54 +00:00
|
|
|
|
|
|
|
// we have to explicitly hit the roomtile which just changed
|
|
|
|
constantTimeDispatcher.dispatch(
|
|
|
|
"RoomTile.refresh", room.roomId, {}
|
|
|
|
);
|
2016-01-07 10:38:44 +00:00
|
|
|
}
|
2015-12-18 17:51:17 +00:00
|
|
|
},
|
|
|
|
|
2015-11-30 16:55:00 +00:00
|
|
|
onRoomName: function(room) {
|
2017-04-17 19:58:43 +00:00
|
|
|
constantTimeDispatcher.dispatch(
|
|
|
|
"RoomTile.refresh", room.roomId, {}
|
|
|
|
);
|
2015-11-30 16:55:00 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
onRoomTags: function(event, room) {
|
2017-04-17 19:58:43 +00:00
|
|
|
// XXX: this happens rarely; ideally we should only update the correct
|
|
|
|
// sublists when it does (e.g. via a constantTimeDispatch to the right sublist)
|
2015-12-18 15:13:59 +00:00
|
|
|
this._delayedRefreshRoomList();
|
2015-11-30 16:55:00 +00:00
|
|
|
},
|
|
|
|
|
2017-04-18 22:29:28 +00:00
|
|
|
onRoomStateMember: function(ev, state, member) {
|
2017-04-22 00:16:16 +00:00
|
|
|
if (ev.getStateKey() === MatrixClientPeg.get().credentials.userId &&
|
|
|
|
ev.getPrevContent() && ev.getPrevContent().membership === "invite")
|
|
|
|
{
|
|
|
|
this._delayedRefreshRoomList();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
constantTimeDispatcher.dispatch(
|
|
|
|
"RoomTile.refresh", member.roomId, {}
|
|
|
|
);
|
|
|
|
}
|
2017-04-18 22:29:28 +00:00
|
|
|
},
|
2015-11-30 16:55:00 +00:00
|
|
|
|
|
|
|
onRoomMemberName: function(ev, member) {
|
2017-04-17 19:58:43 +00:00
|
|
|
constantTimeDispatcher.dispatch(
|
2017-04-20 00:12:57 +00:00
|
|
|
"RoomTile.refresh", member.roomId, {}
|
2017-04-17 19:58:43 +00:00
|
|
|
);
|
2015-12-18 15:13:59 +00:00
|
|
|
},
|
|
|
|
|
2016-09-07 16:46:45 +00:00
|
|
|
onAccountData: function(ev) {
|
|
|
|
if (ev.getType() == 'm.direct') {
|
2017-04-17 19:58:43 +00:00
|
|
|
// XXX: this happens rarely; ideally we should only update the correct
|
|
|
|
// sublists when it does (e.g. via a constantTimeDispatch to the right sublist)
|
2016-09-07 16:46:45 +00:00
|
|
|
this._delayedRefreshRoomList();
|
|
|
|
}
|
2017-04-20 00:12:57 +00:00
|
|
|
else if (ev.getType() == 'm.push_rules') {
|
|
|
|
this._delayedRefreshRoomList();
|
|
|
|
}
|
2016-09-07 16:46:45 +00:00
|
|
|
},
|
|
|
|
|
2016-02-04 18:06:24 +00:00
|
|
|
_delayedRefreshRoomList: new rate_limited_func(function() {
|
2017-04-15 12:23:52 +00:00
|
|
|
// if the mouse has been moving over the RoomList in the last 500ms
|
|
|
|
// then delay the refresh further to avoid bouncing around under the
|
|
|
|
// cursor
|
2017-04-20 12:53:36 +00:00
|
|
|
if (Date.now() - this._lastMouseOverTs > 500 || this._delayedRefreshRoomListLoopCount > 60) {
|
2017-04-15 12:23:52 +00:00
|
|
|
this.refreshRoomList();
|
2017-04-20 12:53:36 +00:00
|
|
|
this._delayedRefreshRoomListLoopCount = 0;
|
2017-04-15 12:23:52 +00:00
|
|
|
}
|
|
|
|
else {
|
2017-04-20 12:53:36 +00:00
|
|
|
this._delayedRefreshRoomListLoopCount++;
|
2017-04-15 12:23:52 +00:00
|
|
|
this._delayedRefreshRoomList();
|
|
|
|
}
|
2016-02-04 18:06:24 +00:00
|
|
|
}, 500),
|
2015-11-30 16:55:00 +00:00
|
|
|
|
|
|
|
refreshRoomList: function() {
|
2015-12-18 15:13:59 +00:00
|
|
|
// console.log("DEBUG: Refresh room list delta=%s ms",
|
|
|
|
// (!this._lastRefreshRoomListTs ? "-" : (Date.now() - this._lastRefreshRoomListTs))
|
|
|
|
// );
|
|
|
|
|
2017-04-17 19:58:43 +00:00
|
|
|
// TODO: ideally we'd calculate this once at start, and then maintain
|
|
|
|
// any changes to it incrementally, updating the appropriate sublists
|
|
|
|
// as needed.
|
|
|
|
// Alternatively we'd do something magical with Immutable.js or similar.
|
2015-11-30 16:55:00 +00:00
|
|
|
this.setState(this.getRoomLists());
|
2017-04-15 12:23:52 +00:00
|
|
|
|
|
|
|
// this._lastRefreshRoomListTs = Date.now();
|
2015-11-30 16:55:00 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
getRoomLists: function() {
|
|
|
|
var self = this;
|
|
|
|
var s = { lists: {} };
|
|
|
|
|
2015-12-11 00:40:28 +00:00
|
|
|
s.lists["im.vector.fake.invite"] = [];
|
2015-11-30 16:55:00 +00:00
|
|
|
s.lists["m.favourite"] = [];
|
2015-12-11 00:40:28 +00:00
|
|
|
s.lists["im.vector.fake.recent"] = [];
|
2016-08-11 15:45:19 +00:00
|
|
|
s.lists["im.vector.fake.direct"] = [];
|
2015-11-30 16:55:00 +00:00
|
|
|
s.lists["m.lowpriority"] = [];
|
2015-12-11 00:40:28 +00:00
|
|
|
s.lists["im.vector.fake.archived"] = [];
|
2015-11-30 16:55:00 +00:00
|
|
|
|
2017-04-17 19:58:43 +00:00
|
|
|
this.listsForRoomId = {};
|
2017-04-18 01:43:29 +00:00
|
|
|
var otherTagNames = {};
|
2017-04-17 19:58:43 +00:00
|
|
|
|
2016-09-06 15:39:21 +00:00
|
|
|
const dmRoomMap = new DMRoomMap(MatrixClientPeg.get());
|
|
|
|
|
2015-11-30 16:55:00 +00:00
|
|
|
MatrixClientPeg.get().getRooms().forEach(function(room) {
|
2016-09-06 15:39:21 +00:00
|
|
|
const me = room.getMember(MatrixClientPeg.get().credentials.userId);
|
2016-03-18 19:59:58 +00:00
|
|
|
if (!me) return;
|
2017-04-18 01:43:29 +00:00
|
|
|
|
2016-04-20 11:25:19 +00:00
|
|
|
// console.log("room = " + room.name + ", me.membership = " + me.membership +
|
2016-03-18 20:08:47 +00:00
|
|
|
// ", sender = " + me.events.member.getSender() +
|
2016-04-20 11:25:19 +00:00
|
|
|
// ", target = " + me.events.member.getStateKey() +
|
2016-03-18 20:08:47 +00:00
|
|
|
// ", prevMembership = " + me.events.member.getPrevContent().membership);
|
2017-04-18 01:43:29 +00:00
|
|
|
|
|
|
|
if (!self.listsForRoomId[room.roomId]) {
|
|
|
|
self.listsForRoomId[room.roomId] = [];
|
|
|
|
}
|
|
|
|
|
2016-03-18 19:59:58 +00:00
|
|
|
if (me.membership == "invite") {
|
2017-04-17 19:58:43 +00:00
|
|
|
self.listsForRoomId[room.roomId].push("im.vector.fake.invite");
|
2015-12-11 00:40:28 +00:00
|
|
|
s.lists["im.vector.fake.invite"].push(room);
|
2015-11-30 16:55:00 +00:00
|
|
|
}
|
2016-09-07 10:33:58 +00:00
|
|
|
else if (HIDE_CONFERENCE_CHANS && Rooms.isConfCallRoom(room, me, self.props.ConferenceHandler)) {
|
2016-09-05 16:42:22 +00:00
|
|
|
// skip past this room & don't put it in any lists
|
|
|
|
}
|
2016-03-18 19:59:58 +00:00
|
|
|
else if (me.membership == "join" || me.membership === "ban" ||
|
2016-03-18 20:08:47 +00:00
|
|
|
(me.membership === "leave" && me.events.member.getSender() !== me.events.member.getStateKey()))
|
|
|
|
{
|
2016-08-11 15:45:19 +00:00
|
|
|
// Used to split rooms via tags
|
|
|
|
var tagNames = Object.keys(room.tags);
|
2016-08-11 16:32:39 +00:00
|
|
|
if (tagNames.length) {
|
2016-08-11 15:45:19 +00:00
|
|
|
for (var i = 0; i < tagNames.length; i++) {
|
|
|
|
var tagName = tagNames[i];
|
|
|
|
s.lists[tagName] = s.lists[tagName] || [];
|
2017-04-18 01:43:29 +00:00
|
|
|
s.lists[tagName].push(room);
|
|
|
|
self.listsForRoomId[room.roomId].push(tagName);
|
|
|
|
otherTagNames[tagName] = 1;
|
2015-11-30 16:55:00 +00:00
|
|
|
}
|
|
|
|
}
|
2016-09-09 16:23:15 +00:00
|
|
|
else if (dmRoomMap.getUserIdForRoomId(room.roomId)) {
|
|
|
|
// "Direct Message" rooms (that we're still in and that aren't otherwise tagged)
|
2017-04-17 19:58:43 +00:00
|
|
|
self.listsForRoomId[room.roomId].push("im.vector.fake.direct");
|
2016-09-09 16:23:15 +00:00
|
|
|
s.lists["im.vector.fake.direct"].push(room);
|
|
|
|
}
|
2016-08-11 15:45:19 +00:00
|
|
|
else {
|
2017-04-17 19:58:43 +00:00
|
|
|
self.listsForRoomId[room.roomId].push("im.vector.fake.recent");
|
2016-08-11 15:45:19 +00:00
|
|
|
s.lists["im.vector.fake.recent"].push(room);
|
|
|
|
}
|
2015-11-30 16:55:00 +00:00
|
|
|
}
|
2016-03-18 19:59:58 +00:00
|
|
|
else if (me.membership === "leave") {
|
2017-04-17 19:58:43 +00:00
|
|
|
self.listsForRoomId[room.roomId].push("im.vector.fake.archived");
|
2016-03-18 19:59:58 +00:00
|
|
|
s.lists["im.vector.fake.archived"].push(room);
|
|
|
|
}
|
|
|
|
else {
|
2016-03-18 20:01:19 +00:00
|
|
|
console.error("unrecognised membership: " + me.membership + " - this should never happen");
|
2016-03-18 19:59:58 +00:00
|
|
|
}
|
2015-11-30 16:55:00 +00:00
|
|
|
});
|
|
|
|
|
2016-09-16 15:15:25 +00:00
|
|
|
if (s.lists["im.vector.fake.direct"].length == 0 &&
|
|
|
|
MatrixClientPeg.get().getAccountData('m.direct') === undefined &&
|
|
|
|
!MatrixClientPeg.get().isGuest())
|
|
|
|
{
|
2016-09-06 15:39:21 +00:00
|
|
|
// scan through the 'recents' list for any rooms which look like DM rooms
|
|
|
|
// and make them DM rooms
|
|
|
|
const oldRecents = s.lists["im.vector.fake.recent"];
|
|
|
|
s.lists["im.vector.fake.recent"] = [];
|
|
|
|
|
|
|
|
for (const room of oldRecents) {
|
|
|
|
const me = room.getMember(MatrixClientPeg.get().credentials.userId);
|
|
|
|
|
2016-09-07 10:33:58 +00:00
|
|
|
if (me && Rooms.looksLikeDirectMessageRoom(room, me)) {
|
2017-04-17 19:58:43 +00:00
|
|
|
self.listsForRoomId[room.roomId].push("im.vector.fake.direct");
|
2016-09-06 15:39:21 +00:00
|
|
|
s.lists["im.vector.fake.direct"].push(room);
|
2016-09-06 16:43:39 +00:00
|
|
|
} else {
|
2017-04-17 19:58:43 +00:00
|
|
|
self.listsForRoomId[room.roomId].push("im.vector.fake.recent");
|
2016-09-06 16:43:39 +00:00
|
|
|
s.lists["im.vector.fake.recent"].push(room);
|
2016-09-06 15:39:21 +00:00
|
|
|
}
|
|
|
|
}
|
2016-09-06 16:43:39 +00:00
|
|
|
|
|
|
|
// save these new guessed DM rooms into the account data
|
|
|
|
const newMDirectEvent = {};
|
|
|
|
for (const room of s.lists["im.vector.fake.direct"]) {
|
|
|
|
const me = room.getMember(MatrixClientPeg.get().credentials.userId);
|
2016-09-07 10:33:58 +00:00
|
|
|
const otherPerson = Rooms.getOnlyOtherMember(room, me);
|
2016-09-06 16:43:39 +00:00
|
|
|
if (!otherPerson) continue;
|
|
|
|
|
|
|
|
const roomList = newMDirectEvent[otherPerson.userId] || [];
|
|
|
|
roomList.push(room.roomId);
|
|
|
|
newMDirectEvent[otherPerson.userId] = roomList;
|
|
|
|
}
|
|
|
|
|
2017-04-17 19:58:43 +00:00
|
|
|
console.warn("Resetting room DM state to be " + JSON.stringify(newMDirectEvent));
|
|
|
|
|
2016-09-06 16:43:39 +00:00
|
|
|
// if this fails, fine, we'll just do the same thing next time we get the room lists
|
|
|
|
MatrixClientPeg.get().setAccountData('m.direct', newMDirectEvent).done();
|
2016-09-06 15:39:21 +00:00
|
|
|
}
|
|
|
|
|
2015-12-11 00:40:28 +00:00
|
|
|
//console.log("calculated new roomLists; im.vector.fake.recent = " + s.lists["im.vector.fake.recent"]);
|
2015-11-30 16:55:00 +00:00
|
|
|
|
|
|
|
// we actually apply the sorting to this when receiving the prop in RoomSubLists.
|
|
|
|
|
2017-04-18 01:43:29 +00:00
|
|
|
// we'll need this when we get to iterating through lists programatically - e.g. ctrl-shift-up/down
|
|
|
|
/*
|
|
|
|
this.listOrder = [
|
|
|
|
"im.vector.fake.invite",
|
|
|
|
"m.favourite",
|
|
|
|
"im.vector.fake.recent",
|
|
|
|
"im.vector.fake.direct",
|
|
|
|
Object.keys(otherTagNames).filter(tagName=>{
|
|
|
|
return (!tagName.match(/^m\.(favourite|lowpriority)$/));
|
|
|
|
}).sort(),
|
|
|
|
"m.lowpriority",
|
|
|
|
"im.vector.fake.archived"
|
|
|
|
];
|
|
|
|
*/
|
|
|
|
|
2015-11-30 16:55:00 +00:00
|
|
|
return s;
|
|
|
|
},
|
|
|
|
|
2015-12-17 02:49:09 +00:00
|
|
|
_getScrollNode: function() {
|
|
|
|
var panel = ReactDOM.findDOMNode(this);
|
|
|
|
if (!panel) return null;
|
|
|
|
|
|
|
|
if (panel.classList.contains('gm-prevented')) {
|
|
|
|
return panel;
|
|
|
|
} else {
|
|
|
|
return panel.children[2]; // XXX: Fragile!
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2016-08-25 18:46:01 +00:00
|
|
|
_whenScrolling: function(e) {
|
2016-09-03 11:44:55 +00:00
|
|
|
this._hideTooltip(e);
|
2015-12-17 02:49:09 +00:00
|
|
|
this._repositionIncomingCallBox(e, false);
|
2016-08-26 14:09:13 +00:00
|
|
|
this._updateStickyHeaders(false);
|
2015-12-17 02:49:09 +00:00
|
|
|
},
|
|
|
|
|
2016-09-03 11:44:55 +00:00
|
|
|
_hideTooltip: function(e) {
|
|
|
|
// Hide tooltip when scrolling, as we'll no longer be over the one we were on
|
|
|
|
if (this.tooltip && this.tooltip.style.display !== "none") {
|
|
|
|
this.tooltip.style.display = "none";
|
2015-12-17 02:49:09 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
_repositionIncomingCallBox: function(e, firstTime) {
|
|
|
|
var incomingCallBox = document.getElementById("incomingCallBox");
|
|
|
|
if (incomingCallBox && incomingCallBox.parentElement) {
|
2016-09-15 13:39:34 +00:00
|
|
|
var scrollArea = this._getScrollNode();
|
|
|
|
// Use the offset of the top of the scroll area from the window
|
|
|
|
// as this is used to calculate the CSS fixed top position for the stickies
|
|
|
|
var scrollAreaOffset = scrollArea.getBoundingClientRect().top + window.pageYOffset;
|
2016-09-15 14:33:08 +00:00
|
|
|
// Use the offset of the top of the componet from the window
|
|
|
|
// as this is used to calculate the CSS fixed top position for the stickies
|
|
|
|
var scrollAreaHeight = ReactDOM.findDOMNode(this).getBoundingClientRect().height;
|
2016-09-15 13:39:34 +00:00
|
|
|
|
2017-01-20 14:22:27 +00:00
|
|
|
var top = (incomingCallBox.parentElement.getBoundingClientRect().top + window.pageYOffset);
|
2016-09-15 14:33:08 +00:00
|
|
|
// Make sure we don't go too far up, if the headers aren't sticky
|
|
|
|
top = (top < scrollAreaOffset) ? scrollAreaOffset : top;
|
|
|
|
// make sure we don't go too far down, if the headers aren't sticky
|
|
|
|
var bottomMargin = scrollAreaOffset + (scrollAreaHeight - 45);
|
|
|
|
top = (top > bottomMargin) ? bottomMargin : top;
|
2016-02-19 02:21:17 +00:00
|
|
|
|
2015-12-17 02:49:09 +00:00
|
|
|
incomingCallBox.style.top = top + "px";
|
2016-09-15 14:33:08 +00:00
|
|
|
incomingCallBox.style.left = scrollArea.offsetLeft + scrollArea.offsetWidth + 12 + "px";
|
2015-11-30 16:55:00 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2016-08-30 11:29:25 +00:00
|
|
|
// Doing the sticky headers as raw DOM, for speed, as it gets very stuttery if done
|
2016-08-30 09:45:17 +00:00
|
|
|
// properly through React
|
2016-08-26 14:09:13 +00:00
|
|
|
_initAndPositionStickyHeaders: function(initialise, scrollToPosition) {
|
2016-08-26 10:01:04 +00:00
|
|
|
var scrollArea = this._getScrollNode();
|
2016-08-28 10:39:47 +00:00
|
|
|
// Use the offset of the top of the scroll area from the window
|
|
|
|
// as this is used to calculate the CSS fixed top position for the stickies
|
2016-09-04 07:01:04 +00:00
|
|
|
var scrollAreaOffset = scrollArea.getBoundingClientRect().top + window.pageYOffset;
|
2016-08-28 18:18:41 +00:00
|
|
|
// Use the offset of the top of the componet from the window
|
|
|
|
// as this is used to calculate the CSS fixed top position for the stickies
|
2016-08-28 15:25:20 +00:00
|
|
|
var scrollAreaHeight = ReactDOM.findDOMNode(this).getBoundingClientRect().height;
|
2016-08-25 18:46:01 +00:00
|
|
|
|
2016-08-26 08:56:07 +00:00
|
|
|
if (initialise) {
|
2016-08-30 09:45:17 +00:00
|
|
|
// Get a collection of sticky header containers references
|
|
|
|
this.stickies = document.getElementsByClassName("mx_RoomSubList_labelContainer");
|
2016-08-26 10:01:04 +00:00
|
|
|
|
2016-08-30 14:22:52 +00:00
|
|
|
if (!this.stickies.length) return;
|
|
|
|
|
2016-08-30 11:29:25 +00:00
|
|
|
// Make sure there is sufficient space to do sticky headers: 120px plus all the sticky headers
|
2016-08-30 09:45:17 +00:00
|
|
|
this.scrollAreaSufficient = (120 + (this.stickies[0].getBoundingClientRect().height * this.stickies.length)) < scrollAreaHeight;
|
2016-08-26 10:01:04 +00:00
|
|
|
|
2016-08-26 14:52:57 +00:00
|
|
|
// Initialise the sticky headers
|
2016-08-30 09:45:17 +00:00
|
|
|
if (typeof this.stickies === "object" && this.stickies.length > 0) {
|
2016-08-28 11:02:20 +00:00
|
|
|
// Initialise the sticky headers
|
2016-08-30 09:45:17 +00:00
|
|
|
Array.prototype.forEach.call(this.stickies, function(sticky, i) {
|
2016-08-28 11:02:20 +00:00
|
|
|
// Save the positions of all the stickies within scroll area.
|
|
|
|
// These positions are relative to the LHS Panel top
|
|
|
|
sticky.dataset.originalPosition = sticky.offsetTop - scrollArea.offsetTop;
|
|
|
|
|
|
|
|
// Save and set the sticky heights
|
|
|
|
var originalHeight = sticky.getBoundingClientRect().height;
|
|
|
|
sticky.dataset.originalHeight = originalHeight;
|
|
|
|
sticky.style.height = originalHeight;
|
|
|
|
|
|
|
|
return sticky;
|
|
|
|
});
|
2016-08-25 18:46:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-08-26 10:01:04 +00:00
|
|
|
var self = this;
|
2016-08-26 14:09:13 +00:00
|
|
|
var scrollStuckOffset = 0;
|
2016-08-28 18:18:41 +00:00
|
|
|
// Scroll to the passed in position, i.e. a header was clicked and in a scroll to state
|
|
|
|
// rather than a collapsable one (see RoomSubList.isCollapsableOnClick method for details)
|
2016-08-26 14:09:13 +00:00
|
|
|
if (scrollToPosition !== undefined) {
|
|
|
|
scrollArea.scrollTop = scrollToPosition;
|
2016-08-26 13:36:39 +00:00
|
|
|
}
|
2016-08-26 14:52:57 +00:00
|
|
|
// Stick headers to top and bottom, or free them
|
2016-08-30 09:45:17 +00:00
|
|
|
Array.prototype.forEach.call(this.stickies, function(sticky, i, stickyWrappers) {
|
2016-08-25 18:46:01 +00:00
|
|
|
var stickyPosition = sticky.dataset.originalPosition;
|
|
|
|
var stickyHeight = sticky.dataset.originalHeight;
|
|
|
|
var stickyHeader = sticky.childNodes[0];
|
|
|
|
var topStuckHeight = stickyHeight * i;
|
2017-01-20 14:22:27 +00:00
|
|
|
var bottomStuckHeight = stickyHeight * (stickyWrappers.length - i);
|
2016-08-25 18:46:01 +00:00
|
|
|
|
2016-08-26 14:52:57 +00:00
|
|
|
if (self.scrollAreaSufficient && stickyPosition < (scrollArea.scrollTop + topStuckHeight)) {
|
2016-08-25 18:46:01 +00:00
|
|
|
// Top stickies
|
2016-08-26 13:36:39 +00:00
|
|
|
sticky.dataset.stuck = "top";
|
2016-08-25 18:46:01 +00:00
|
|
|
stickyHeader.classList.add("mx_RoomSubList_fixed");
|
2016-08-26 17:31:02 +00:00
|
|
|
stickyHeader.style.top = scrollAreaOffset + topStuckHeight + "px";
|
2016-08-26 14:52:57 +00:00
|
|
|
// If stuck at top adjust the scroll back down to take account of all the stuck headers
|
2016-08-26 14:36:16 +00:00
|
|
|
if (scrollToPosition !== undefined && stickyPosition === scrollToPosition) {
|
|
|
|
scrollStuckOffset = topStuckHeight;
|
|
|
|
}
|
2016-08-28 18:18:41 +00:00
|
|
|
} else if (self.scrollAreaSufficient && stickyPosition > ((scrollArea.scrollTop + scrollAreaHeight) - bottomStuckHeight)) {
|
2016-08-25 18:46:01 +00:00
|
|
|
/// Bottom stickies
|
2016-08-26 13:36:39 +00:00
|
|
|
sticky.dataset.stuck = "bottom";
|
2016-08-25 18:46:01 +00:00
|
|
|
stickyHeader.classList.add("mx_RoomSubList_fixed");
|
2016-08-26 17:31:02 +00:00
|
|
|
stickyHeader.style.top = (scrollAreaOffset + scrollAreaHeight) - bottomStuckHeight + "px";
|
2016-08-25 18:46:01 +00:00
|
|
|
} else {
|
|
|
|
// Not sticky
|
2016-08-26 13:36:39 +00:00
|
|
|
sticky.dataset.stuck = "none";
|
2016-08-25 18:46:01 +00:00
|
|
|
stickyHeader.classList.remove("mx_RoomSubList_fixed");
|
|
|
|
stickyHeader.style.top = null;
|
|
|
|
}
|
|
|
|
});
|
2016-08-26 14:52:57 +00:00
|
|
|
// Adjust the scroll to take account of top stuck headers
|
2016-08-26 14:09:13 +00:00
|
|
|
if (scrollToPosition !== undefined) {
|
|
|
|
scrollArea.scrollTop -= scrollStuckOffset;
|
|
|
|
}
|
2016-08-25 18:46:01 +00:00
|
|
|
},
|
|
|
|
|
2016-08-26 14:09:13 +00:00
|
|
|
_updateStickyHeaders: function(initialise, scrollToPosition) {
|
2016-08-25 18:46:01 +00:00
|
|
|
var self = this;
|
|
|
|
|
2016-08-26 08:56:07 +00:00
|
|
|
if (initialise) {
|
2016-08-26 10:01:04 +00:00
|
|
|
// Useing setTimeout to ensure that the code is run after the painting
|
|
|
|
// of the newly rendered object as using requestAnimationFrame caused
|
|
|
|
// artefacts to appear on screen briefly
|
|
|
|
window.setTimeout(function() {
|
2016-08-26 14:09:13 +00:00
|
|
|
self._initAndPositionStickyHeaders(initialise, scrollToPosition);
|
2016-08-25 18:46:01 +00:00
|
|
|
});
|
|
|
|
} else {
|
2016-08-26 14:09:13 +00:00
|
|
|
this._initAndPositionStickyHeaders(initialise, scrollToPosition);
|
2016-08-25 18:46:01 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2016-01-22 15:46:38 +00:00
|
|
|
onShowMoreRooms: function() {
|
|
|
|
// kick gemini in the balls to get it to wake up
|
|
|
|
// XXX: uuuuuuugh.
|
|
|
|
this.refs.gemscroll.forceUpdate();
|
|
|
|
},
|
|
|
|
|
2015-11-30 16:55:00 +00:00
|
|
|
render: function() {
|
2015-12-01 15:45:11 +00:00
|
|
|
var RoomSubList = sdk.getComponent('structures.RoomSubList');
|
2015-11-30 16:55:00 +00:00
|
|
|
var self = this;
|
|
|
|
|
|
|
|
return (
|
2016-04-20 11:25:19 +00:00
|
|
|
<GeminiScrollbar className="mx_RoomList_scrollbar"
|
2016-08-25 18:46:01 +00:00
|
|
|
autoshow={true} onScroll={ self._whenScrolling } ref="gemscroll">
|
2017-04-15 12:23:52 +00:00
|
|
|
<div className="mx_RoomList" onMouseOver={ this._onMouseOver }>
|
2015-12-11 00:40:28 +00:00
|
|
|
<RoomSubList list={ self.state.lists['im.vector.fake.invite'] }
|
2015-11-30 16:55:00 +00:00
|
|
|
label="Invites"
|
2017-04-20 14:15:20 +00:00
|
|
|
tagName="im.vector.fake.invite"
|
2015-11-30 16:55:00 +00:00
|
|
|
editable={ false }
|
|
|
|
order="recent"
|
2015-12-17 02:49:09 +00:00
|
|
|
incomingCall={ self.state.incomingCall }
|
2016-01-22 15:46:38 +00:00
|
|
|
collapsed={ self.props.collapsed }
|
2017-04-20 00:12:57 +00:00
|
|
|
selectedRoom={ self.props.selectedRoom }
|
2016-04-15 16:55:00 +00:00
|
|
|
searchFilter={ self.props.searchFilter }
|
2016-08-26 08:56:07 +00:00
|
|
|
onHeaderClick={ self.onSubListHeaderClick }
|
2016-04-15 16:55:00 +00:00
|
|
|
onShowMoreRooms={ self.onShowMoreRooms } />
|
2015-11-30 16:55:00 +00:00
|
|
|
|
|
|
|
<RoomSubList list={ self.state.lists['m.favourite'] }
|
|
|
|
label="Favourites"
|
|
|
|
tagName="m.favourite"
|
|
|
|
verb="favourite"
|
|
|
|
editable={ true }
|
|
|
|
order="manual"
|
2015-12-17 02:49:09 +00:00
|
|
|
incomingCall={ self.state.incomingCall }
|
2016-01-22 15:46:38 +00:00
|
|
|
collapsed={ self.props.collapsed }
|
2017-04-20 00:12:57 +00:00
|
|
|
selectedRoom={ self.props.selectedRoom }
|
2016-04-15 16:55:00 +00:00
|
|
|
searchFilter={ self.props.searchFilter }
|
2016-08-26 08:56:07 +00:00
|
|
|
onHeaderClick={ self.onSubListHeaderClick }
|
2016-04-15 16:55:00 +00:00
|
|
|
onShowMoreRooms={ self.onShowMoreRooms } />
|
2015-11-30 16:55:00 +00:00
|
|
|
|
2016-08-22 13:10:51 +00:00
|
|
|
<RoomSubList list={ self.state.lists['im.vector.fake.direct'] }
|
2016-09-13 18:47:41 +00:00
|
|
|
label="People"
|
2017-03-17 11:59:22 +00:00
|
|
|
tagName="im.vector.fake.direct"
|
|
|
|
verb="tag direct chat"
|
2017-03-16 11:31:47 +00:00
|
|
|
editable={ true }
|
2015-11-30 16:55:00 +00:00
|
|
|
order="recent"
|
2015-12-17 02:49:09 +00:00
|
|
|
incomingCall={ self.state.incomingCall }
|
2016-01-22 15:46:38 +00:00
|
|
|
collapsed={ self.props.collapsed }
|
2017-04-20 00:12:57 +00:00
|
|
|
selectedRoom={ self.props.selectedRoom }
|
2017-03-16 11:31:47 +00:00
|
|
|
alwaysShowHeader={ true }
|
2016-04-15 16:55:00 +00:00
|
|
|
searchFilter={ self.props.searchFilter }
|
2016-08-26 08:56:07 +00:00
|
|
|
onHeaderClick={ self.onSubListHeaderClick }
|
2016-04-15 16:55:00 +00:00
|
|
|
onShowMoreRooms={ self.onShowMoreRooms } />
|
2015-11-30 16:55:00 +00:00
|
|
|
|
2016-08-22 13:10:51 +00:00
|
|
|
<RoomSubList list={ self.state.lists['im.vector.fake.recent'] }
|
|
|
|
label="Rooms"
|
2017-04-20 14:15:20 +00:00
|
|
|
tagName="im.vector.fake.recent"
|
2016-08-22 13:10:51 +00:00
|
|
|
editable={ true }
|
|
|
|
verb="restore"
|
2016-08-11 15:45:19 +00:00
|
|
|
order="recent"
|
|
|
|
incomingCall={ self.state.incomingCall }
|
|
|
|
collapsed={ self.props.collapsed }
|
2017-04-20 00:12:57 +00:00
|
|
|
selectedRoom={ self.props.selectedRoom }
|
2016-08-11 15:45:19 +00:00
|
|
|
searchFilter={ self.props.searchFilter }
|
2016-08-26 08:56:07 +00:00
|
|
|
onHeaderClick={ self.onSubListHeaderClick }
|
2016-08-11 15:45:19 +00:00
|
|
|
onShowMoreRooms={ self.onShowMoreRooms } />
|
|
|
|
|
2017-04-18 01:43:29 +00:00
|
|
|
{ Object.keys(self.state.lists).sort().map(function(tagName) {
|
2016-08-11 15:45:19 +00:00
|
|
|
if (!tagName.match(/^(m\.(favourite|lowpriority)|im\.vector\.fake\.(invite|recent|direct|archived))$/)) {
|
2015-11-30 16:55:00 +00:00
|
|
|
return <RoomSubList list={ self.state.lists[tagName] }
|
|
|
|
key={ tagName }
|
|
|
|
label={ tagName }
|
|
|
|
tagName={ tagName }
|
|
|
|
verb={ "tag as " + tagName }
|
|
|
|
editable={ true }
|
|
|
|
order="manual"
|
2015-12-17 02:49:09 +00:00
|
|
|
incomingCall={ self.state.incomingCall }
|
2016-01-22 15:46:38 +00:00
|
|
|
collapsed={ self.props.collapsed }
|
2017-04-20 00:12:57 +00:00
|
|
|
selectedRoom={ self.props.selectedRoom }
|
2016-04-15 16:55:00 +00:00
|
|
|
searchFilter={ self.props.searchFilter }
|
2016-08-26 08:56:07 +00:00
|
|
|
onHeaderClick={ self.onSubListHeaderClick }
|
2017-01-20 14:22:27 +00:00
|
|
|
onShowMoreRooms={ self.onShowMoreRooms } />;
|
2015-11-30 16:55:00 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
}) }
|
|
|
|
|
|
|
|
<RoomSubList list={ self.state.lists['m.lowpriority'] }
|
|
|
|
label="Low priority"
|
|
|
|
tagName="m.lowpriority"
|
|
|
|
verb="demote"
|
|
|
|
editable={ true }
|
|
|
|
order="recent"
|
2015-12-17 02:49:09 +00:00
|
|
|
incomingCall={ self.state.incomingCall }
|
2016-01-22 15:46:38 +00:00
|
|
|
collapsed={ self.props.collapsed }
|
2017-04-20 00:12:57 +00:00
|
|
|
selectedRoom={ self.props.selectedRoom }
|
2016-04-15 16:55:00 +00:00
|
|
|
searchFilter={ self.props.searchFilter }
|
2016-08-26 08:56:07 +00:00
|
|
|
onHeaderClick={ self.onSubListHeaderClick }
|
2016-04-15 16:55:00 +00:00
|
|
|
onShowMoreRooms={ self.onShowMoreRooms } />
|
2015-11-30 16:55:00 +00:00
|
|
|
|
2015-12-11 00:40:28 +00:00
|
|
|
<RoomSubList list={ self.state.lists['im.vector.fake.archived'] }
|
2015-11-30 16:55:00 +00:00
|
|
|
label="Historical"
|
2017-04-20 14:15:20 +00:00
|
|
|
tagName="im.vector.fake.archived"
|
2015-11-30 16:55:00 +00:00
|
|
|
editable={ false }
|
|
|
|
order="recent"
|
2015-12-18 11:55:43 +00:00
|
|
|
collapsed={ self.props.collapsed }
|
2017-04-20 00:12:57 +00:00
|
|
|
selectedRoom={ self.props.selectedRoom }
|
2015-12-18 11:55:43 +00:00
|
|
|
alwaysShowHeader={ true }
|
2015-12-18 15:13:59 +00:00
|
|
|
startAsHidden={ true }
|
|
|
|
showSpinner={ self.state.isLoadingLeftRooms }
|
2015-12-18 16:59:25 +00:00
|
|
|
onHeaderClick= { self.onArchivedHeaderClick }
|
2016-01-22 15:46:38 +00:00
|
|
|
incomingCall={ self.state.incomingCall }
|
2016-04-15 16:55:00 +00:00
|
|
|
searchFilter={ self.props.searchFilter }
|
|
|
|
onShowMoreRooms={ self.onShowMoreRooms } />
|
2015-11-30 16:55:00 +00:00
|
|
|
</div>
|
|
|
|
</GeminiScrollbar>
|
|
|
|
);
|
|
|
|
}
|
2015-12-04 14:24:02 +00:00
|
|
|
});
|