From 36cd22663a8c4eb2a526b28f64105c4c14647636 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Mon, 6 Nov 2017 18:02:50 +0000 Subject: [PATCH 1/5] Open group settings when the group is created --- src/components/structures/GroupView.js | 9 +++++++-- src/components/structures/LoggedInView.js | 1 + src/components/structures/MatrixChat.js | 5 ++++- src/components/views/dialogs/CreateGroupDialog.js | 1 + 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/components/structures/GroupView.js b/src/components/structures/GroupView.js index 24aa552890..88d10573cf 100644 --- a/src/components/structures/GroupView.js +++ b/src/components/structures/GroupView.js @@ -392,6 +392,8 @@ export default React.createClass({ propTypes: { groupId: PropTypes.string.isRequired, + // Whether this is the first time the group admin is viewing the group + groupIsNew: PropTypes.bool, }, childContextTypes: { @@ -422,7 +424,7 @@ export default React.createClass({ componentWillMount: function() { this._changeAvatarComponent = null; - this._initGroupStore(this.props.groupId); + this._initGroupStore(this.props.groupId, true); MatrixClientPeg.get().on("Group.myMembership", this._onGroupMyMembership); }, @@ -449,7 +451,7 @@ export default React.createClass({ this.setState({membershipBusy: false}); }, - _initGroupStore: function(groupId) { + _initGroupStore: function(groupId, firstInit) { this._groupStore = GroupStoreCache.getGroupStore(MatrixClientPeg.get(), groupId); this._groupStore.registerListener(() => { const summary = this._groupStore.getSummary(); @@ -472,6 +474,9 @@ export default React.createClass({ ), error: null, }); + if (this.props.groupIsNew && firstInit) { + this._onEditClick(); + } }); this._groupStore.on('error', (err) => { this.setState({ diff --git a/src/components/structures/LoggedInView.js b/src/components/structures/LoggedInView.js index 5d1d47c5b2..08120d9508 100644 --- a/src/components/structures/LoggedInView.js +++ b/src/components/structures/LoggedInView.js @@ -301,6 +301,7 @@ export default React.createClass({ case PageTypes.GroupView: page_element = ; if (!this.props.collapseRhs) right_panel = ; diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index e679276a08..e8ca8e82fc 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -490,7 +490,10 @@ module.exports = React.createClass({ case 'view_group': { const groupId = payload.group_id; - this.setState({currentGroupId: groupId}); + this.setState({ + currentGroupId: groupId, + currentGroupIsNew: payload.group_is_new, + }); this._setPage(PageTypes.GroupView); this.notifyNewScreen('group/' + groupId); } diff --git a/src/components/views/dialogs/CreateGroupDialog.js b/src/components/views/dialogs/CreateGroupDialog.js index e1dfe388d6..168fe75947 100644 --- a/src/components/views/dialogs/CreateGroupDialog.js +++ b/src/components/views/dialogs/CreateGroupDialog.js @@ -81,6 +81,7 @@ export default React.createClass({ dis.dispatch({ action: 'view_group', group_id: result.group_id, + group_is_new: true, }); this.props.onFinished(true); }).catch((e) => { From 137f1311b3bc2889732879b1ad40ef611e18cedd Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Mon, 6 Nov 2017 18:03:00 +0000 Subject: [PATCH 2/5] Add useful placeholder for the long description textarea --- src/components/structures/GroupView.js | 10 ++++++++++ src/i18n/strings/en_EN.json | 1 + 2 files changed, 11 insertions(+) diff --git a/src/components/structures/GroupView.js b/src/components/structures/GroupView.js index 88d10573cf..a76d825451 100644 --- a/src/components/structures/GroupView.js +++ b/src/components/structures/GroupView.js @@ -867,6 +867,16 @@ export default React.createClass({

{ _t("Long Description (HTML)") }