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) => {