From 03747b82872ce2f14ef7925182ed6d739ceb7dd1 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 5 Apr 2018 16:56:35 +0100 Subject: [PATCH] Update to use new join_policy API --- src/components/structures/GroupView.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/components/structures/GroupView.js b/src/components/structures/GroupView.js index 5931217363..8f2087cadf 100644 --- a/src/components/structures/GroupView.js +++ b/src/components/structures/GroupView.js @@ -1,6 +1,6 @@ /* Copyright 2017 Vector Creations Ltd. -Copyright 2017 New Vector Ltd. +Copyright 2017, 2018 New Vector Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -399,8 +399,8 @@ FeaturedRoom.contextTypes = GroupContext; RoleUserList.contextTypes = GroupContext; FeaturedUser.contextTypes = GroupContext; -const GROUP_JOINABLE = "GROUP_JOINABLE"; -const GROUP_NOT_JOINABLE = "GROUP_NOT_JOINABLE"; +const GROUP_JOINPOLICY_OPEN = "open"; +const GROUP_JOINPOLICY_INVITE = "invite"; export default React.createClass({ displayName: 'GroupView', @@ -549,7 +549,7 @@ export default React.createClass({ editing: true, profileForm: Object.assign({}, this.state.summary.profile), joinableForm: { - isJoinable: this.state.summary.profile.is_joinable, + policyType: this.state.summary.profile.join_policy, }, }); dis.dispatch({ @@ -615,7 +615,7 @@ export default React.createClass({ _onJoinableChange: function(ev) { this.setState({ - joinableForm: { isJoinable: ev.target.value === GROUP_JOINABLE }, + joinableForm: { policyType: ev.target.value }, }); }, @@ -654,7 +654,9 @@ export default React.createClass({ _saveGroup: async function() { await this._matrixClient.setGroupProfile(this.props.groupId, this.state.profileForm); - await this._matrixClient.setGroupJoinable(this.props.groupId, this.state.joinableForm.isJoinable); + await this._matrixClient.setGroupJoinPolicy(this.props.groupId, { + type: this.state.joinableForm.policyType, + }); }, _onAcceptInviteClick: function() { @@ -1010,8 +1012,8 @@ export default React.createClass({