Partial merge of develop to experimental

Does not include #2336 as the file has been moved out from underneath it:
will do this separately
This commit is contained in:
David Baker 2019-01-03 15:02:58 +00:00
parent 00405e7f22
commit 7d161de35b
77 changed files with 3526 additions and 598 deletions

View file

@ -83,6 +83,7 @@ module.exports = React.createClass({
isLoadingLeftRooms: false,
totalRoomCount: null,
lists: {},
incomingCallTag: null,
incomingCall: null,
selectedTags: [],
};
@ -199,11 +200,13 @@ module.exports = React.createClass({
if (call && call.call_state === 'ringing') {
this.setState({
incomingCall: call,
incomingCallTag: this.getTagNameForRoomId(payload.room_id),
});
this._repositionIncomingCallBox(undefined, true);
} else {
this.setState({
incomingCall: null,
incomingCallTag: null,
});
}
break;
@ -368,6 +371,26 @@ module.exports = React.createClass({
// this._lastRefreshRoomListTs = Date.now();
},
getTagNameForRoomId: function(roomId) {
const lists = RoomListStore.getRoomLists();
for (const tagName of Object.keys(lists)) {
for (const room of lists[tagName]) {
// Should be impossible, but guard anyways.
if (!room) {
continue;
}
const myUserId = MatrixClientPeg.get().getUserId();
if (HIDE_CONFERENCE_CHANS && Rooms.isConfCallRoom(room, myUserId, this.props.ConferenceHandler)) {
continue;
}
if (room.roomId === roomId) return tagName;
}
}
return null;
},
getRoomLists: function() {
const lists = RoomListStore.getRoomLists();
@ -581,6 +604,12 @@ module.exports = React.createClass({
},
render: function() {
const incomingCallIfTaggedAs = (tagName) => {
if (!this.state.incomingCall) return null;
if (this.state.incomingCallTag !== tagName) return null;
return this.state.incomingCall;
};
let subLists = [
{
list: [],
@ -593,6 +622,7 @@ module.exports = React.createClass({
list: this.state.lists['im.vector.fake.invite'],
label: _t('Invites'),
order: "recent",
incomingCall={incomingCallIfTaggedAs('im.vector.fake.invite')},
isInvite: true,
},
{
@ -600,6 +630,7 @@ module.exports = React.createClass({
label: _t('Favourites'),
tagName: "m.favourite",
order: "manual",
incomingCall={incomingCallIfTaggedAs('m.favourite')},
},
{
list: this.state.lists['im.vector.fake.direct'],
@ -607,6 +638,7 @@ module.exports = React.createClass({
tagName: "im.vector.fake.direct",
headerItems: this._getHeaderItems('im.vector.fake.direct'),
order: "recent",
incomingCall={incomingCallIfTaggedAs('im.vector.fake.direct')},
onAddRoom: () => {dis.dispatch({action: 'view_create_chat'})},
},
{
@ -614,6 +646,7 @@ module.exports = React.createClass({
label: _t('Rooms'),
headerItems: this._getHeaderItems('im.vector.fake.recent'),
order: "recent",
incomingCall={incomingCallIfTaggedAs('im.vector.fake.recent')},
onAddRoom: () => {dis.dispatch({action: 'view_create_room'})},
},
];
@ -627,6 +660,7 @@ module.exports = React.createClass({
label: labelForTagName(tagName),
tagName: tagName,
order: "manual",
incomingCallIfTaggedAs(tagName),
};
});
subLists = subLists.concat(tagSubLists);
@ -636,11 +670,13 @@ module.exports = React.createClass({
label: _t('Low priority'),
tagName: "m.lowpriority",
order: "recent",
incomingCall={incomingCallIfTaggedAs('m.lowpriority')},
},
{
list: this.state.lists['im.vector.fake.archived'],
label: _t('Historical'),
order: "recent",
incomingCall={incomingCallIfTaggedAs('im.vector.fake.archived')},
startAsHidden: true,
showSpinner: this.state.isLoadingLeftRooms,
onHeaderClick: this.onArchivedHeaderClick,
@ -650,6 +686,7 @@ module.exports = React.createClass({
label: _t('System Alerts'),
tagName: "m.lowpriority",
order: "recent",
incomingCall={incomingCallIfTaggedAs('m.server_notice')},
},
]);