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:"
}