From fa37d03db65b564ba1cab3c0630e8b57c0840e28 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 6 Jul 2017 19:13:14 +0100 Subject: [PATCH 01/11] Improve the Group View page Show the rooms in the group in thir various categories, etc --- src/components/structures/GroupView.js | 114 ++++++++++++++++++++- src/components/views/avatars/RoomAvatar.js | 11 +- src/i18n/strings/en_EN.json | 3 +- 3 files changed, 124 insertions(+), 4 deletions(-) diff --git a/src/components/structures/GroupView.js b/src/components/structures/GroupView.js index 0f10ba60e2..0a7674f4d8 100644 --- a/src/components/structures/GroupView.js +++ b/src/components/structures/GroupView.js @@ -18,10 +18,67 @@ import React from 'react'; import PropTypes from 'prop-types'; import MatrixClientPeg from '../../MatrixClientPeg'; import sdk from '../../index'; +import dis from '../../dispatcher'; import { sanitizedHtmlNode } from '../../HtmlUtils'; import { _t } from '../../languageHandler'; +import AccessibleButton from '../views/elements/AccessibleButton'; +function categoryRoomListNode(rooms, categoryId, category) { + const roomNodes = rooms.map((r) => { + return ; + }); + let catHeader = null; + if (category && category.profile) catHeader =
{category.profile.name}
+ return
+ {catHeader} + {roomNodes} +
; +} + +const FeaturedRoom = React.createClass({ + displayName: 'FeaturedRoom', + + props: { + summaryInfo: PropTypes.object.isRequired, + }, + + onClick: function(e) { + e.preventDefault(); + + dis.dispatch({ + action: 'view_room', + room_alias: this.props.summaryInfo.profile.canonical_alias, + room_id: this.props.summaryInfo.room_id, + }); + }, + + render: function() { + const RoomAvatar = sdk.getComponent("avatars.RoomAvatar"); + + const oobData = { + roomId: this.props.summaryInfo.room_id, + avatarUrl: this.props.summaryInfo.profile.avatar_url, + name: this.props.summaryInfo.profile.name, + }; + let permalink = null; + if (this.props.summaryInfo.profile && this.props.summaryInfo.profile.canonical_alias) { + permalink = 'https://matrix.to/#/' + this.props.summaryInfo.profile.canonical_alias; + } + let roomNameNode = null; + if (permalink) { + roomNameNode = {this.props.summaryInfo.profile.name}; + } else { + roomNameNode = {this.props.summaryInfo.profile.name}; + } + + return + +
{roomNameNode}
+
; + } +}); + export default React.createClass({ displayName: 'GroupView', @@ -33,6 +90,7 @@ export default React.createClass({ return { summary: null, error: null, + editing: false, }; }, @@ -64,12 +122,19 @@ export default React.createClass({ }); }, + _onSettingsClick: function() { + this.setState({editing: true}); + }, + render: function() { const GroupAvatar = sdk.getComponent("avatars.GroupAvatar"); const Loader = sdk.getComponent("elements.Spinner"); + const TintableSvg = sdk.getComponent("elements.TintableSvg"); if (this.state.summary === null && this.state.error === null) { return ; + } else if (this.state.editing) { + return
; } else if (this.state.summary) { const summary = this.state.summary; let description = null; @@ -77,6 +142,50 @@ export default React.createClass({ description = sanitizedHtmlNode(summary.profile.long_description); } + let featuredRooms = null; + if (summary.rooms_section.rooms.length > 0) { + let defaultCategoryRooms = []; + let categoryRooms = {}; + summary.rooms_section.rooms.forEach((r) => { + if (r.category_id === null) { + defaultCategoryRooms.push(r); + } else { + let list = categoryRooms[r.category_id]; + if (list === undefined) { + list = []; + categoryRooms[r.category_id] = list; + } + list.push(r); + } + }); + /*[defaultCategoryRooms, ...Object.values(categoryRooms)].forEach((roomList) => { + roomList.sort((r1, r2) => { + return r1.order - r2.order; + }); + });*/ + + let defaultCategoryNode = null; + if (defaultCategoryRooms.length > 0) { + defaultCategoryNode = categoryRoomListNode(defaultCategoryRooms); + } + const categoryRoomNodes = Object.keys(categoryRooms).map((catId) => { + const cat = summary.rooms_section.categories[catId]; + return categoryRoomListNode(categoryRooms[catId], catId, cat); + }); + + featuredRooms =
+
+ {_t('Featured Rooms:')} +
+ {defaultCategoryNode} + {categoryRoomNodes} +
; + } + const roomBody =
+
{description}
+ {featuredRooms} +
; + let nameNode; if (summary.profile.name) { nameNode =
@@ -108,9 +217,12 @@ export default React.createClass({ {summary.profile.short_description}
+ + + - {description} + {roomBody} ); } else if (this.state.error) { diff --git a/src/components/views/avatars/RoomAvatar.js b/src/components/views/avatars/RoomAvatar.js index 8041fd5cd7..728d71a6a9 100644 --- a/src/components/views/avatars/RoomAvatar.js +++ b/src/components/views/avatars/RoomAvatar.js @@ -126,9 +126,16 @@ module.exports = React.createClass({ }, getFallbackAvatar: function(props) { - if (!this.props.room) return null; + let roomId = null; + if (props.oobData && props.oobData.roomId) { + roomId = this.props.oobData.roomId; + } else if (props.room) { + roomId = props.room.roomId; + } else { + return null; + } - return Avatar.defaultAvatarUrlForString(props.room.roomId); + return Avatar.defaultAvatarUrlForString(roomId); }, render: function() { diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 2b0f15703c..f187a6f034 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -946,5 +946,6 @@ "You are a member of these groups": "You are a member of these groups", "Create a group to represent your community! Define a set of rooms and your own custom homepage to mark out your space in the Matrix universe.": "Create a group to represent your community! Define a set of rooms and your own custom homepage to mark out your space in the Matrix universe.", "Join an existing group": "Join an existing group", - "To join an exisitng group you'll have to know its group identifier; this will look something like +example:matrix.org.": "To join an exisitng group you'll have to know its group identifier; this will look something like +example:matrix.org." + "To join an exisitng group you'll have to know its group identifier; this will look something like +example:matrix.org.": "To join an exisitng group you'll have to know its group identifier; this will look something like +example:matrix.org.", + "Featured Rooms:": "Featured Rooms:" } From 681fd512d792593b3de347be7f338b8289f1588d Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 7 Jul 2017 13:46:05 +0100 Subject: [PATCH 02/11] Lint --- src/components/structures/GroupView.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/structures/GroupView.js b/src/components/structures/GroupView.js index 18b9340b4a..8a93af403b 100644 --- a/src/components/structures/GroupView.js +++ b/src/components/structures/GroupView.js @@ -29,7 +29,9 @@ function categoryRoomListNode(rooms, categoryId, category) { return ; }); let catHeader = null; - if (category && category.profile) catHeader =
{category.profile.name}
+ if (category && category.profile) { + catHeader =
{category.profile.name}
; + } return
{catHeader} {roomNodes} @@ -76,7 +78,7 @@ const FeaturedRoom = React.createClass({
{roomNameNode}
; - } + }, }); export default React.createClass({ From 49ca29e422b4994637df0858357a6793d83fba01 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 10 Jul 2017 14:07:16 +0100 Subject: [PATCH 03/11] Lint --- src/components/structures/GroupView.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/structures/GroupView.js b/src/components/structures/GroupView.js index 2b44e9eec4..0a790471ac 100644 --- a/src/components/structures/GroupView.js +++ b/src/components/structures/GroupView.js @@ -147,8 +147,8 @@ export default React.createClass({ let featuredRooms = null; if (summary.rooms_section.rooms.length > 0) { - let defaultCategoryRooms = []; - let categoryRooms = {}; + const defaultCategoryRooms = []; + const categoryRooms = {}; summary.rooms_section.rooms.forEach((r) => { if (r.category_id === null) { defaultCategoryRooms.push(r); From 048912a241ee8034a65e2e422116249646a0370f Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 10 Jul 2017 15:17:58 +0100 Subject: [PATCH 04/11] Remove commented ordering code No lomger needed now roosm come down in order --- src/components/structures/GroupView.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/components/structures/GroupView.js b/src/components/structures/GroupView.js index 0a790471ac..f33e7321cd 100644 --- a/src/components/structures/GroupView.js +++ b/src/components/structures/GroupView.js @@ -161,11 +161,6 @@ export default React.createClass({ list.push(r); } }); - /*[defaultCategoryRooms, ...Object.values(categoryRooms)].forEach((roomList) => { - roomList.sort((r1, r2) => { - return r1.order - r2.order; - }); - });*/ let defaultCategoryNode = null; if (defaultCategoryRooms.length > 0) { From 0e67a9158c9772caaade4f1f9d2bd6e9561b08b8 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 10 Jul 2017 15:32:57 +0100 Subject: [PATCH 05/11] hide settings button until it's wired up --- src/components/structures/GroupView.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/structures/GroupView.js b/src/components/structures/GroupView.js index f33e7321cd..0d85c69d17 100644 --- a/src/components/structures/GroupView.js +++ b/src/components/structures/GroupView.js @@ -217,7 +217,8 @@ export default React.createClass({ {summary.profile.short_description}
- + // display: none until settings is wired up + From 925d5bd480f60356a389af5ebd4db5cd47f1bf7e Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 10 Jul 2017 19:32:02 +0100 Subject: [PATCH 06/11] Add featured users to Group View --- src/components/structures/GroupView.js | 167 ++++++++++++++++++------ src/components/structures/MatrixChat.js | 8 +- src/i18n/strings/en_EN.json | 3 +- 3 files changed, 135 insertions(+), 43 deletions(-) diff --git a/src/components/structures/GroupView.js b/src/components/structures/GroupView.js index 0d85c69d17..da4162d6e0 100644 --- a/src/components/structures/GroupView.js +++ b/src/components/structures/GroupView.js @@ -30,7 +30,7 @@ function categoryRoomListNode(rooms, categoryId, category) { }); let catHeader = null; if (category && category.profile) { - catHeader =
{category.profile.name}
; + catHeader =
{category.profile.name}
; } return
{catHeader} @@ -47,6 +47,7 @@ const FeaturedRoom = React.createClass({ onClick: function(e) { e.preventDefault(); + e.stopPropagation(); dis.dispatch({ action: 'view_room', @@ -74,9 +75,54 @@ const FeaturedRoom = React.createClass({ roomNameNode = {this.props.summaryInfo.profile.name}; } - return + return -
{roomNameNode}
+
{roomNameNode}
+
; + }, +}); + +function roleUserListNode(users, roleId, role) { + const userNodes = users.map((u) => { + return ; + }); + let roleHeader = null; + if (role && role.profile) { + roleHeader =
{role.profile.name}
; + } + return
+ {roleHeader} + {userNodes} +
; +} + +const FeaturedUser = React.createClass({ + displayName: 'FeaturedUser', + + props: { + summaryInfo: PropTypes.object.isRequired, + }, + + onClick: function(e) { + e.preventDefault(); + e.stopPropagation(); + + dis.dispatch({ + action: 'view_start_chat_or_reuse', + user_id: this.props.summaryInfo.user_id, + go_home_on_cancel: false, + }); + }, + + render: function() { + // Add avatar once we get profile info inline in the summary response + //const BaseAvatar = sdk.getComponent("avatars.BaseAvatar"); + + const permalink = 'https://matrix.to/#/' + this.props.summaryInfo.user_id; + const userNameNode = {this.props.summaryInfo.user_id}; + + return +
{userNameNode}
; }, }); @@ -129,6 +175,82 @@ export default React.createClass({ this.setState({editing: true}); }, + _getFeaturedRoomsNode() { + const summary = this.state.summary; + + if (summary.rooms_section.rooms.length == 0) return null; + + const defaultCategoryRooms = []; + const categoryRooms = {}; + summary.rooms_section.rooms.forEach((r) => { + if (r.category_id === null) { + defaultCategoryRooms.push(r); + } else { + let list = categoryRooms[r.category_id]; + if (list === undefined) { + list = []; + categoryRooms[r.category_id] = list; + } + list.push(r); + } + }); + + let defaultCategoryNode = null; + if (defaultCategoryRooms.length > 0) { + defaultCategoryNode = categoryRoomListNode(defaultCategoryRooms); + } + const categoryRoomNodes = Object.keys(categoryRooms).map((catId) => { + const cat = summary.rooms_section.categories[catId]; + return categoryRoomListNode(categoryRooms[catId], catId, cat); + }); + + return
+
+ {_t('Featured Rooms:')} +
+ {defaultCategoryNode} + {categoryRoomNodes} +
; + }, + + _getFeaturedUsersNode() { + const summary = this.state.summary; + + if (summary.users_section.users.length == 0) return null; + + const noRoleUsers = []; + const roleUsers = {}; + summary.users_section.users.forEach((u) => { + if (u.role_id === null) { + noRoleUsers.push(u); + } else { + let list = roleUsers[u.role_id]; + if (list === undefined) { + list = []; + roleUsers[u.role_id] = list; + } + list.push(u); + } + }); + + let noRoleNode = null; + if (noRoleUsers.length > 0) { + noRoleNode = roleUserListNode(noRoleUsers); + } + const roleUserNodes = Object.keys(roleUsers).map((roleId) => { + const role = summary.users_section.roles[roleId]; + return roleUserListNode(roleUsers[roleId], roleId, role); + }); + + return
+
+ {_t('Featured Users:')} +
+ {noRoleNode} + {roleUserNodes} +
; + }, + render: function() { const GroupAvatar = sdk.getComponent("avatars.GroupAvatar"); const Loader = sdk.getComponent("elements.Spinner"); @@ -145,43 +267,10 @@ export default React.createClass({ description = sanitizedHtmlNode(summary.profile.long_description); } - let featuredRooms = null; - if (summary.rooms_section.rooms.length > 0) { - const defaultCategoryRooms = []; - const categoryRooms = {}; - summary.rooms_section.rooms.forEach((r) => { - if (r.category_id === null) { - defaultCategoryRooms.push(r); - } else { - let list = categoryRooms[r.category_id]; - if (list === undefined) { - list = []; - categoryRooms[r.category_id] = list; - } - list.push(r); - } - }); - - let defaultCategoryNode = null; - if (defaultCategoryRooms.length > 0) { - defaultCategoryNode = categoryRoomListNode(defaultCategoryRooms); - } - const categoryRoomNodes = Object.keys(categoryRooms).map((catId) => { - const cat = summary.rooms_section.categories[catId]; - return categoryRoomListNode(categoryRooms[catId], catId, cat); - }); - - featuredRooms =
-
- {_t('Featured Rooms:')} -
- {defaultCategoryNode} - {categoryRoomNodes} -
; - } const roomBody =
{description}
- {featuredRooms} + {this._getFeaturedRoomsNode()} + {this._getFeaturedUsersNode()}
; let nameNode; @@ -200,6 +289,7 @@ export default React.createClass({ const groupAvatarUrl = summary.profile ? summary.profile.avatar_url : null; + // settings button is display: none until settings is wired up return (
@@ -217,7 +307,6 @@ export default React.createClass({ {summary.profile.short_description}
- // display: none until settings is wired up diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index f0337fdd8e..f9166db748 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -506,7 +506,7 @@ module.exports = React.createClass({ this._setMxId(payload); break; case 'view_start_chat_or_reuse': - this._chatCreateOrReuse(payload.user_id); + this._chatCreateOrReuse(payload.user_id, payload.go_home_on_cancel); break; case 'view_create_chat': this._createChat(); @@ -801,7 +801,9 @@ module.exports = React.createClass({ }); }, - _chatCreateOrReuse: function(userId) { + _chatCreateOrReuse: function(userId, go_home_on_cancel) { + if (go_home_on_cancel === undefined) go_home_on_cancel = true; + const ChatCreateOrReuseDialog = sdk.getComponent( 'views.dialogs.ChatCreateOrReuseDialog', ); @@ -832,7 +834,7 @@ module.exports = React.createClass({ const close = Modal.createDialog(ChatCreateOrReuseDialog, { userId: userId, onFinished: (success) => { - if (!success) { + if (!success && go_home_on_cancel) { // Dialog cancelled, default to home dis.dispatch({ action: 'view_home_page' }); } diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 0551695b03..b8a59d47fd 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -953,5 +953,6 @@ "Join an existing group": "Join an existing group", "To join an exisitng group you'll have to know its group identifier; this will look something like +example:matrix.org.": "To join an exisitng group you'll have to know its group identifier; this will look something like +example:matrix.org.", "Featured Rooms:": "Featured Rooms:", - "Error whilst fetching joined groups": "Error whilst fetching joined groups" + "Error whilst fetching joined groups": "Error whilst fetching joined groups", + "Featured Users:": "Featured Users:" } From 29990296d264e7ca6a84c04944460497e18e2fb2 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 11 Jul 2017 11:02:23 +0100 Subject: [PATCH 07/11] Lint --- src/components/structures/MatrixChat.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index f9166db748..75a15d71ee 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -801,8 +801,8 @@ module.exports = React.createClass({ }); }, - _chatCreateOrReuse: function(userId, go_home_on_cancel) { - if (go_home_on_cancel === undefined) go_home_on_cancel = true; + _chatCreateOrReuse: function(userId, goHomeOnCancel) { + if (goHomeOnCancel === undefined) goHomeOnCancel = true; const ChatCreateOrReuseDialog = sdk.getComponent( 'views.dialogs.ChatCreateOrReuseDialog', @@ -834,7 +834,7 @@ module.exports = React.createClass({ const close = Modal.createDialog(ChatCreateOrReuseDialog, { userId: userId, onFinished: (success) => { - if (!success && go_home_on_cancel) { + if (!success && goHomeOnCancel) { // Dialog cancelled, default to home dis.dispatch({ action: 'view_home_page' }); } From 222ca054c50f645482b88282da25b489590a55dd Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 11 Jul 2017 13:41:00 +0100 Subject: [PATCH 08/11] Use PropTypes.shape to define our required inputs --- src/components/structures/GroupView.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/components/structures/GroupView.js b/src/components/structures/GroupView.js index da4162d6e0..92ba36a18f 100644 --- a/src/components/structures/GroupView.js +++ b/src/components/structures/GroupView.js @@ -42,7 +42,14 @@ const FeaturedRoom = React.createClass({ displayName: 'FeaturedRoom', props: { - summaryInfo: PropTypes.object.isRequired, + summaryInfo: PropTypes.shape({ + room_id: PropTypes.string.isRequired, + profile: PropTypes.shape({ + name: PropTypes.string, + avatar_url: PropTypes.string, + canonical_alias: PropTypes.string, + }).isRequired, + }).isRequired, }, onClick: function(e) { @@ -100,7 +107,9 @@ const FeaturedUser = React.createClass({ displayName: 'FeaturedUser', props: { - summaryInfo: PropTypes.object.isRequired, + summaryInfo: PropTypes.shape({ + user_id: PropTypes.string.isRequired, + }).isRequired, }, onClick: function(e) { From 8690ed2181bcfbf2d9e98c96fc9f1cde06ffbe19 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 11 Jul 2017 14:28:44 +0100 Subject: [PATCH 09/11] Make the category functions React components --- src/components/structures/GroupView.js | 115 ++++++++++++++++--------- 1 file changed, 74 insertions(+), 41 deletions(-) diff --git a/src/components/structures/GroupView.js b/src/components/structures/GroupView.js index 92ba36a18f..39cf5ece8f 100644 --- a/src/components/structures/GroupView.js +++ b/src/components/structures/GroupView.js @@ -23,33 +23,54 @@ import { sanitizedHtmlNode } from '../../HtmlUtils'; import { _t } from '../../languageHandler'; import AccessibleButton from '../views/elements/AccessibleButton'; +const RoomSummaryType = PropTypes.shape({ + room_id: PropTypes.string.isRequired, + profile: PropTypes.shape({ + name: PropTypes.string, + avatar_url: PropTypes.string, + canonical_alias: PropTypes.string, + }).isRequired +}); -function categoryRoomListNode(rooms, categoryId, category) { - const roomNodes = rooms.map((r) => { - return ; - }); - let catHeader = null; - if (category && category.profile) { - catHeader =
{category.profile.name}
; - } - return
- {catHeader} - {roomNodes} -
; -} +const UserSummaryType = PropTypes.shape({ + summaryInfo: PropTypes.shape({ + user_id: PropTypes.string.isRequired, + }).isRequired, +}); + +const CategoryRoomList = React.createClass({ + displayName: 'CategoryRoomList', + + props: { + rooms: PropTypes.arrayOf(RoomSummaryType).isRequired, + categoryId: PropTypes.string, + category: PropTypes.shape({ + profile: PropTypes.shape({ + name: PropTypes.string, + }).isRequired, + }), + }, + + render: function() { + const roomNodes = this.props.rooms.map((r) => { + return ; + }); + let catHeader = null; + if (this.props.category && this.props.category.profile) { + catHeader =
{this.props.category.profile.name}
; + } + return
+ {catHeader} + {roomNodes} +
; + }, +}); const FeaturedRoom = React.createClass({ displayName: 'FeaturedRoom', props: { - summaryInfo: PropTypes.shape({ - room_id: PropTypes.string.isRequired, - profile: PropTypes.shape({ - name: PropTypes.string, - avatar_url: PropTypes.string, - canonical_alias: PropTypes.string, - }).isRequired, - }).isRequired, + summaryInfo: RoomSummaryType.isRequired, }, onClick: function(e) { @@ -89,27 +110,39 @@ const FeaturedRoom = React.createClass({ }, }); -function roleUserListNode(users, roleId, role) { - const userNodes = users.map((u) => { - return ; - }); - let roleHeader = null; - if (role && role.profile) { - roleHeader =
{role.profile.name}
; - } - return
- {roleHeader} - {userNodes} -
; -} +const RoleUserList = React.createClass({ + displayName: 'RoleUserList', + + props: { + users: PropTypes.arrayOf(UserSummaryType).isRequired, + roleId: PropTypes.string, + role: PropTypes.shape({ + profile: PropTypes.shape({ + name: PropTypes.string, + }).isRequired, + }), + }, + + render: function() { + const userNodes = this.props.users.map((u) => { + return ; + }); + let roleHeader = null; + if (this.props.role && this.props.role.profile) { + roleHeader =
{this.props.role.profile.name}
; + } + return
+ {roleHeader} + {userNodes} +
; + }, +}); const FeaturedUser = React.createClass({ displayName: 'FeaturedUser', props: { - summaryInfo: PropTypes.shape({ - user_id: PropTypes.string.isRequired, - }).isRequired, + summaryInfo: UserSummaryType.isRequired, }, onClick: function(e) { @@ -206,11 +239,11 @@ export default React.createClass({ let defaultCategoryNode = null; if (defaultCategoryRooms.length > 0) { - defaultCategoryNode = categoryRoomListNode(defaultCategoryRooms); + defaultCategoryNode = ; } const categoryRoomNodes = Object.keys(categoryRooms).map((catId) => { const cat = summary.rooms_section.categories[catId]; - return categoryRoomListNode(categoryRooms[catId], catId, cat); + return ; }); return
@@ -244,11 +277,11 @@ export default React.createClass({ let noRoleNode = null; if (noRoleUsers.length > 0) { - noRoleNode = roleUserListNode(noRoleUsers); + noRoleNode = ; } const roleUserNodes = Object.keys(roleUsers).map((roleId) => { const role = summary.users_section.roles[roleId]; - return roleUserListNode(roleUsers[roleId], roleId, role); + return ; }); return
From 4e49ebd6ce14df71b4de54bb8ab063f0230d303c Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 11 Jul 2017 14:31:07 +0100 Subject: [PATCH 10/11] Change incorrect refs to this.props --- src/components/views/avatars/RoomAvatar.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/views/avatars/RoomAvatar.js b/src/components/views/avatars/RoomAvatar.js index 728d71a6a9..a18a52b3c0 100644 --- a/src/components/views/avatars/RoomAvatar.js +++ b/src/components/views/avatars/RoomAvatar.js @@ -72,7 +72,7 @@ module.exports = React.createClass({ }, getRoomAvatarUrl: function(props) { - if (!this.props.room) return null; + if (!props.room) return null; return props.room.getAvatarUrl( MatrixClientPeg.get().getHomeserverUrl(), @@ -84,7 +84,7 @@ module.exports = React.createClass({ }, getOneToOneAvatar: function(props) { - if (!this.props.room) return null; + if (!props.room) return null; var mlist = props.room.currentState.members; var userIds = []; From ff3c21ef107e51c92a67488582af754e3d34d177 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 11 Jul 2017 15:16:58 +0100 Subject: [PATCH 11/11] Lint, including putting key in right place --- src/components/structures/GroupView.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/components/structures/GroupView.js b/src/components/structures/GroupView.js index 39cf5ece8f..30d67202e7 100644 --- a/src/components/structures/GroupView.js +++ b/src/components/structures/GroupView.js @@ -29,7 +29,7 @@ const RoomSummaryType = PropTypes.shape({ name: PropTypes.string, avatar_url: PropTypes.string, canonical_alias: PropTypes.string, - }).isRequired + }).isRequired, }); const UserSummaryType = PropTypes.shape({ @@ -42,8 +42,7 @@ const CategoryRoomList = React.createClass({ displayName: 'CategoryRoomList', props: { - rooms: PropTypes.arrayOf(RoomSummaryType).isRequired, - categoryId: PropTypes.string, + rooms: PropTypes.arrayOf(RoomSummaryType).isRequired, category: PropTypes.shape({ profile: PropTypes.shape({ name: PropTypes.string, @@ -59,7 +58,7 @@ const CategoryRoomList = React.createClass({ if (this.props.category && this.props.category.profile) { catHeader =
{this.props.category.profile.name}
; } - return
+ return
{catHeader} {roomNodes}
; @@ -115,7 +114,6 @@ const RoleUserList = React.createClass({ props: { users: PropTypes.arrayOf(UserSummaryType).isRequired, - roleId: PropTypes.string, role: PropTypes.shape({ profile: PropTypes.shape({ name: PropTypes.string, @@ -131,7 +129,7 @@ const RoleUserList = React.createClass({ if (this.props.role && this.props.role.profile) { roleHeader =
{this.props.role.profile.name}
; } - return
+ return
{roleHeader} {userNodes}
; @@ -243,7 +241,7 @@ export default React.createClass({ } const categoryRoomNodes = Object.keys(categoryRooms).map((catId) => { const cat = summary.rooms_section.categories[catId]; - return ; + return ; }); return
@@ -281,7 +279,7 @@ export default React.createClass({ } const roleUserNodes = Object.keys(roleUsers).map((roleId) => { const role = summary.users_section.roles[roleId]; - return ; + return ; }); return