switch to fake tag names for fake tags, and highlight new invites

This commit is contained in:
Matthew Hodgson 2015-12-11 00:40:28 +00:00
parent 1bb0f4859f
commit 77464c669f

View file

@ -103,8 +103,11 @@ module.exports = React.createClass({
hl = 1; hl = 1;
} }
var me = room.getMember(MatrixClientPeg.get().credentials.userId);
var actions = MatrixClientPeg.get().getPushActionsForEvent(ev); var actions = MatrixClientPeg.get().getPushActionsForEvent(ev);
if (actions && actions.tweaks && actions.tweaks.highlight) { if ((actions && actions.tweaks && actions.tweaks.highlight) ||
(me && me.membership == "invite"))
{
hl = 2; hl = 2;
} }
} }
@ -153,17 +156,17 @@ module.exports = React.createClass({
var self = this; var self = this;
var s = { lists: {} }; var s = { lists: {} };
s.lists["m.invite"] = []; s.lists["im.vector.fake.invite"] = [];
s.lists["m.favourite"] = []; s.lists["m.favourite"] = [];
s.lists["m.recent"] = []; s.lists["im.vector.fake.recent"] = [];
s.lists["m.lowpriority"] = []; s.lists["m.lowpriority"] = [];
s.lists["m.archived"] = []; s.lists["im.vector.fake.archived"] = [];
MatrixClientPeg.get().getRooms().forEach(function(room) { MatrixClientPeg.get().getRooms().forEach(function(room) {
var me = room.getMember(MatrixClientPeg.get().credentials.userId); var me = room.getMember(MatrixClientPeg.get().credentials.userId);
if (me && me.membership == "invite") { if (me && me.membership == "invite") {
s.lists["m.invite"].push(room); s.lists["im.vector.fake.invite"].push(room);
} }
else { else {
var shouldShowRoom = ( var shouldShowRoom = (
@ -196,13 +199,13 @@ module.exports = React.createClass({
} }
} }
else { else {
s.lists["m.recent"].push(room); s.lists["im.vector.fake.recent"].push(room);
} }
} }
} }
}); });
//console.log("calculated new roomLists; m.recent = " + s.lists["m.recent"]); //console.log("calculated new roomLists; im.vector.fake.recent = " + s.lists["im.vector.fake.recent"]);
// we actually apply the sorting to this when receiving the prop in RoomSubLists. // we actually apply the sorting to this when receiving the prop in RoomSubLists.
@ -235,7 +238,7 @@ module.exports = React.createClass({
<div className="mx_RoomList"> <div className="mx_RoomList">
{ expandButton } { expandButton }
<RoomSubList list={ self.state.lists['m.invite'] } <RoomSubList list={ self.state.lists['im.vector.fake.invite'] }
label="Invites" label="Invites"
editable={ false } editable={ false }
order="recent" order="recent"
@ -253,7 +256,7 @@ module.exports = React.createClass({
selectedRoom={ self.props.selectedRoom } selectedRoom={ self.props.selectedRoom }
collapsed={ self.props.collapsed } /> collapsed={ self.props.collapsed } />
<RoomSubList list={ self.state.lists['m.recent'] } <RoomSubList list={ self.state.lists['im.vector.fake.recent'] }
label="Conversations" label="Conversations"
editable={ true } editable={ true }
verb="restore" verb="restore"
@ -263,7 +266,7 @@ module.exports = React.createClass({
collapsed={ self.props.collapsed } /> collapsed={ self.props.collapsed } />
{ Object.keys(self.state.lists).map(function(tagName) { { Object.keys(self.state.lists).map(function(tagName) {
if (!tagName.match(/^m\.(invite|favourite|recent|lowpriority|archived)$/)) { if (!tagName.match(/^(m\.(favourite|lowpriority)|im\.vector\.fake\.(invite|recent|archived))$/)) {
return <RoomSubList list={ self.state.lists[tagName] } return <RoomSubList list={ self.state.lists[tagName] }
key={ tagName } key={ tagName }
label={ tagName } label={ tagName }
@ -284,12 +287,12 @@ module.exports = React.createClass({
verb="demote" verb="demote"
editable={ true } editable={ true }
order="recent" order="recent"
bottommost={ self.state.lists['m.archived'].length === 0 } bottommost={ self.state.lists['im.vector.fake.archived'].length === 0 }
activityMap={ self.state.activityMap } activityMap={ self.state.activityMap }
selectedRoom={ self.props.selectedRoom } selectedRoom={ self.props.selectedRoom }
collapsed={ self.props.collapsed } /> collapsed={ self.props.collapsed } />
<RoomSubList list={ self.state.lists['m.archived'] } <RoomSubList list={ self.state.lists['im.vector.fake.archived'] }
label="Historical" label="Historical"
editable={ false } editable={ false }
order="recent" order="recent"