Merge branch 'experimental' into bwindels/roomgridview-experimental

This commit is contained in:
Bruno Windels 2019-01-07 14:17:57 +01:00
commit 290dc9d8fb
146 changed files with 5292 additions and 1051 deletions

View file

@ -122,10 +122,6 @@ class GroupStore extends EventEmitter {
);
},
};
this.on('error', (err, groupId) => {
console.error(`GroupStore encountered error whilst fetching data for ${groupId}`, err);
});
}
_fetchResource(stateKey, groupId) {
@ -148,7 +144,7 @@ class GroupStore extends EventEmitter {
}
console.error(`Failed to get resource ${stateKey} for ${groupId}`, err);
this.emit('error', err, groupId);
this.emit('error', err, groupId, stateKey);
}).finally(() => {
// Indicate finished request, allow for future fetches
delete this._fetchResourcePromise[stateKey][groupId];

View file

@ -224,9 +224,9 @@ class RoomListStore extends Store {
}
}
// ignore any m. tag names we don't know about
// ignore tags we don't know about
tagNames = tagNames.filter((t) => {
return !t.startsWith('m.') || lists[t] !== undefined;
return lists[t] !== undefined;
});
if (tagNames.length) {
@ -300,6 +300,10 @@ class RoomListStore extends Store {
const ts = this._tsOfNewestEvent(room);
this._updateCachedRoomState(roomId, "timestamp", ts);
return ts;
} else if (type === "unread-muted") {
const unread = Unread.doesRoomHaveUnreadMessages(room);
this._updateCachedRoomState(roomId, "unread-muted", unread);
return unread;
} else if (type === "unread") {
const unread = room.getUnreadNotificationCount() > 0;
this._updateCachedRoomState(roomId, "unread", unread);
@ -358,8 +362,21 @@ class RoomListStore extends Store {
}
if (pinUnread) {
const unreadA = this._getRoomState(roomA, "unread");
const unreadB = this._getRoomState(roomB, "unread");
let unreadA = this._getRoomState(roomA, "unread");
let unreadB = this._getRoomState(roomB, "unread");
if (unreadA && !unreadB) return -1;
if (!unreadA && unreadB) return 1;
// If they both have unread messages, sort by timestamp
// If nether have unread message (the fourth check not shown
// here), then just sort by timestamp anyways.
if (unreadA && unreadB) return timestampDiff;
// Unread can also mean "unread without badge", which is
// different from what the above checks for. We're also
// going to sort those here.
unreadA = this._getRoomState(roomA, "unread-muted");
unreadB = this._getRoomState(roomB, "unread-muted");
if (unreadA && !unreadB) return -1;
if (!unreadA && unreadB) return 1;

View file

@ -195,6 +195,11 @@ export class RoomViewStore extends Store {
err: err,
});
let msg = err.message ? err.message : JSON.stringify(err);
// XXX: We are relying on the error message returned by browsers here.
// This isn't great, but it does generalize the error being shown to users.
if (msg && msg.startsWith("CORS request rejected")) {
msg = _t("There was an error joining the room");
}
if (err.errcode === 'M_INCOMPATIBLE_ROOM_VERSION') {
msg = <div>
{_t("Sorry, your homeserver is too old to participate in this room.")}<br />