diff --git a/src/components/views/dialogs/UnknownDeviceDialog.js b/src/components/views/dialogs/UnknownDeviceDialog.js
index 09c4cc2411..cd6e4a3403 100644
--- a/src/components/views/dialogs/UnknownDeviceDialog.js
+++ b/src/components/views/dialogs/UnknownDeviceDialog.js
@@ -49,9 +49,8 @@ function UserUnknownDeviceList(props) {
const {userId, userDevices} = props;
const deviceListEntries = Object.keys(userDevices).map((deviceId) =>
- ,
+ ,
);
return (
@@ -94,52 +93,23 @@ export default React.createClass({
propTypes: {
room: React.PropTypes.object.isRequired,
+ // map from userid -> deviceid -> deviceinfo
+ devices: React.PropTypes.object.isRequired,
onFinished: React.PropTypes.func.isRequired,
},
- componentWillMount: function() {
- this._unmounted = false;
-
- const roomMembers = this.props.room.getJoinedMembers().map((m) => {
- return m.userId;
- });
-
- this.setState({
- // map from userid -> deviceid -> deviceinfo
- devices: null,
- });
- MatrixClientPeg.get().downloadKeys(roomMembers, false).then((devices) => {
- if (this._unmounted) return;
-
- const unknownDevices = {};
- // This is all devices in this room, so find the unknown ones.
- Object.keys(devices).forEach((userId) => {
- Object.keys(devices[userId]).map((deviceId) => {
- const device = devices[userId][deviceId];
-
- if (device.isUnverified() && !device.isKnown()) {
- if (unknownDevices[userId] === undefined) {
- unknownDevices[userId] = {};
- }
- unknownDevices[userId][deviceId] = device;
- }
-
- // Given we've now shown the user the unknown device, it is no longer
- // unknown to them. Therefore mark it as 'known'.
- if (!device.isKnown()) {
- MatrixClientPeg.get().setDeviceKnown(userId, deviceId, true);
- }
- });
- });
-
- this.setState({
- devices: unknownDevices,
+ componentDidMount: function() {
+ // Given we've now shown the user the unknown device, it is no longer
+ // unknown to them. Therefore mark it as 'known'.
+ Object.keys(this.props.devices).forEach((userId) => {
+ Object.keys(this.props.devices[userId]).map((deviceId) => {
+ MatrixClientPeg.get().setDeviceKnown(userId, deviceId, true);
});
});
- },
- componentWillUnmount: function() {
- this._unmounted = true;
+ // XXX: temporary logging to try to diagnose
+ // https://github.com/vector-im/riot-web/issues/3148
+ console.log('Opening UnknownDeviceDialog');
},
render: function() {
@@ -186,7 +156,7 @@ export default React.createClass({
{ warning }
{ _t("Unknown devices") }:
-
+
uniqueMembers[userId]);
+ // Descending sort on isPrivileged = true = 1 to isPrivileged = false = 0
memberList.sort((a, b) => {
- // TODO: should put admins at the top: we don't yet have that info
- if (a < b) {
- return -1;
- } else if (a > b) {
- return 1;
+ if (a.isPrivileged === b.isPrivileged) {
+ const aName = a.displayname || a.userId;
+ const bName = b.displayname || b.userId;
+ if (aName < bName) {
+ return -1;
+ } else if (aName > bName) {
+ return 1;
+ } else {
+ return 0;
+ }
} else {
- return 0;
+ return a.isPrivileged ? -1 : 1;
}
});
diff --git a/src/components/views/groups/GroupMemberTile.js b/src/components/views/groups/GroupMemberTile.js
index 84c2adcb41..f967a33f46 100644
--- a/src/components/views/groups/GroupMemberTile.js
+++ b/src/components/views/groups/GroupMemberTile.js
@@ -63,7 +63,7 @@ export default withMatrixClient(React.createClass({
return (
);
},
diff --git a/src/components/views/groups/GroupRoomList.js b/src/components/views/groups/GroupRoomList.js
index aeded2dfb0..ff27d093b2 100644
--- a/src/components/views/groups/GroupRoomList.js
+++ b/src/components/views/groups/GroupRoomList.js
@@ -94,7 +94,7 @@ export default React.createClass({
let roomList = this.state.rooms;
if (query) {
roomList = roomList.filter((room) => {
- const matchesName = (room.name || "").toLowerCase().include(query);
+ const matchesName = (room.name || "").toLowerCase().includes(query);
const matchesAlias = (room.canonicalAlias || "").toLowerCase().includes(query);
return matchesName || matchesAlias;
});
diff --git a/src/groups.js b/src/groups.js
index 957db1d85b..860cf71fff 100644
--- a/src/groups.js
+++ b/src/groups.js
@@ -36,7 +36,7 @@ export function groupMemberFromApiObject(apiObject) {
userId: apiObject.user_id,
displayname: apiObject.displayname,
avatarUrl: apiObject.avatar_url,
- isAdmin: apiObject.is_admin,
+ isPrivileged: apiObject.is_privileged,
};
}
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json
index b94e89a113..c3ba45e82c 100644
--- a/src/i18n/strings/en_EN.json
+++ b/src/i18n/strings/en_EN.json
@@ -49,7 +49,7 @@
"Name or matrix ID": "Name or matrix ID",
"Invite to Community": "Invite to Community",
"Which rooms would you like to add to this community?": "Which rooms would you like to add to this community?",
- "Warning: any room you add to a community will be publicly visible to anyone who knows the community ID": "Warning: any room you add to a community will be publicly visible to anyone who knows the community ID",
+ "Show these rooms to non-members on the community page and room list?": "Show these rooms to non-members on the community page and room list?",
"Add rooms to the community": "Add rooms to the community",
"Room name or alias": "Room name or alias",
"Add to community": "Add to community",
diff --git a/src/stores/FlairStore.js b/src/stores/FlairStore.js
index 1d20148c0d..0f339eaf63 100644
--- a/src/stores/FlairStore.js
+++ b/src/stores/FlairStore.js
@@ -69,9 +69,13 @@ class FlairStore extends EventEmitter {
}
// Bulk lookup ongoing, return promise to resolve/reject
- if (this._usersPending[userId] || this._usersInFlight[userId]) {
+ if (this._usersPending[userId]) {
return this._usersPending[userId].prom;
}
+ // User has been moved from pending to in-flight
+ if (this._usersInFlight[userId]) {
+ return this._usersInFlight[userId].prom;
+ }
this._usersPending[userId] = {};
this._usersPending[userId].prom = new Promise((resolve, reject) => {
diff --git a/src/stores/GroupStore.js b/src/stores/GroupStore.js
index 11dd664053..fdd776f74d 100644
--- a/src/stores/GroupStore.js
+++ b/src/stores/GroupStore.js
@@ -169,6 +169,14 @@ export default class GroupStore extends EventEmitter {
.then(this._fetchMembers.bind(this));
}
+ acceptGroupInvite() {
+ return this._matrixClient.acceptGroupInvite(this.groupId)
+ // The user might be able to see more rooms now
+ .then(this._fetchRooms.bind(this))
+ // The user should now appear as a member
+ .then(this._fetchMembers.bind(this));
+ }
+
addRoomToGroupSummary(roomId, categoryId) {
return this._matrixClient
.addRoomToGroupSummary(this.groupId, roomId, categoryId)