From b2cd65e182c7628469622d8f97646152406ffd81 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 3 Nov 2017 12:30:58 +0000 Subject: [PATCH 1/8] Fixes React warning Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/elements/Dropdown.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/components/views/elements/Dropdown.js b/src/components/views/elements/Dropdown.js index 3787523a56..b1291710b7 100644 --- a/src/components/views/elements/Dropdown.js +++ b/src/components/views/elements/Dropdown.js @@ -26,11 +26,9 @@ class MenuOption extends React.Component { this._onClick = this._onClick.bind(this); } - getDefaultProps() { - return { - disabled: false, - }; - } + static defaultProps = { + disabled: false, + }; _onMouseEnter() { this.props.onMouseEnter(this.props.dropdownKey); From e84e4ed5f5804639493d04ddb695ebd9adcca18c Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Fri, 3 Nov 2017 15:38:12 +0000 Subject: [PATCH 2/8] Add CSS classes to group ID input in CreateGroupDialog --- src/components/views/dialogs/CreateGroupDialog.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/views/dialogs/CreateGroupDialog.js b/src/components/views/dialogs/CreateGroupDialog.js index 12f419ddd6..38d61cfc11 100644 --- a/src/components/views/dialogs/CreateGroupDialog.js +++ b/src/components/views/dialogs/CreateGroupDialog.js @@ -137,16 +137,18 @@ export default React.createClass({
-
- + - + + + - :{ MatrixClientPeg.get().getDomain() } + + :{ MatrixClientPeg.get().getDomain() } +
From b88c13d5274b878db07a9177f6a6bba5d9fda29c Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Fri, 3 Nov 2017 16:02:41 +0000 Subject: [PATCH 3/8] Use prefixed class names to avoid collisions with other libraries --- src/components/views/dialogs/CreateGroupDialog.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/views/dialogs/CreateGroupDialog.js b/src/components/views/dialogs/CreateGroupDialog.js index 38d61cfc11..e1dfe388d6 100644 --- a/src/components/views/dialogs/CreateGroupDialog.js +++ b/src/components/views/dialogs/CreateGroupDialog.js @@ -138,15 +138,16 @@ export default React.createClass({
- + - + + - + :{ MatrixClientPeg.get().getDomain() }
From 98312a464762aa3e984c76e5ef611f1e307c0d9d Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Fri, 3 Nov 2017 17:37:13 +0000 Subject: [PATCH 4/8] Use, if possible, a room's canonical or first alias when viewing the room (Only affects rooms the user has never joined) --- src/components/views/rooms/RoomDetailList.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/views/rooms/RoomDetailList.js b/src/components/views/rooms/RoomDetailList.js index 5374094f1f..69f3faa325 100644 --- a/src/components/views/rooms/RoomDetailList.js +++ b/src/components/views/rooms/RoomDetailList.js @@ -49,6 +49,7 @@ const RoomDetailRow = React.createClass({ dis.dispatch({ action: 'view_room', room_id: this.props.room.roomId, + room_alias: this.props.room.canonicalAlias || this.props.room.aliases[0], }); }, From 58f1757f0cd350d213f6bc3e68a8900810f052b2 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Fri, 3 Nov 2017 17:52:36 +0000 Subject: [PATCH 5/8] Handle rooms with no aliases or canonical alias --- src/components/views/rooms/RoomDetailList.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/rooms/RoomDetailList.js b/src/components/views/rooms/RoomDetailList.js index 69f3faa325..c44b662fa7 100644 --- a/src/components/views/rooms/RoomDetailList.js +++ b/src/components/views/rooms/RoomDetailList.js @@ -49,7 +49,7 @@ const RoomDetailRow = React.createClass({ dis.dispatch({ action: 'view_room', room_id: this.props.room.roomId, - room_alias: this.props.room.canonicalAlias || this.props.room.aliases[0], + room_alias: this.props.room.canonicalAlias || (this.props.room.aliases || [])[0], }); }, From d64fc4c842ca993b10b9a7e764d481c4c5fbe4ed Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Fri, 3 Nov 2017 18:19:10 +0000 Subject: [PATCH 6/8] Fix Flair not appearing due to missing this._usersInFlight --- src/stores/FlairStore.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/stores/FlairStore.js b/src/stores/FlairStore.js index 9424503390..411065eee0 100644 --- a/src/stores/FlairStore.js +++ b/src/stores/FlairStore.js @@ -48,6 +48,9 @@ class FlairStore extends EventEmitter { // reject: () => {} // } }; + this._usersInFlight = { + // see _usersPending + }; this._debounceTimeoutID = null; } From 4d8f18742b5dc1563f58867604e215a7685df411 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Fri, 3 Nov 2017 18:43:43 +0000 Subject: [PATCH 7/8] Check against non-existant promise to resolve a user's groups --- src/stores/FlairStore.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/stores/FlairStore.js b/src/stores/FlairStore.js index 411065eee0..587890da7f 100644 --- a/src/stores/FlairStore.js +++ b/src/stores/FlairStore.js @@ -128,12 +128,16 @@ class FlairStore extends EventEmitter { } catch (err) { // Propagate the same error to all usersInFlight Object.keys(this._usersInFlight).forEach((userId) => { + // The promise should always exist for userId, but do a null-check anyway + if (!this._usersInFlight[userId]) return; this._usersInFlight[userId].reject(err); }); return; } const updatedUserGroups = resp.users; Object.keys(this._usersInFlight).forEach((userId) => { + // The promise should always exist for userId, but do a null-check anyway + if (!this._usersInFlight[userId]) return; this._usersInFlight[userId].resolve(updatedUserGroups[userId] || []); }); } From da23afdec228fff34c24dd8b923f8b0490078e7b Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Fri, 3 Nov 2017 18:48:15 +0000 Subject: [PATCH 8/8] Better comment on FlairStore _usersInFlight --- src/stores/FlairStore.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stores/FlairStore.js b/src/stores/FlairStore.js index 587890da7f..1d20148c0d 100644 --- a/src/stores/FlairStore.js +++ b/src/stores/FlairStore.js @@ -49,7 +49,7 @@ class FlairStore extends EventEmitter { // } }; this._usersInFlight = { - // see _usersPending + // This has the same schema as _usersPending }; this._debounceTimeoutID = null;