From 730ca9b60b7ad1dbe03d949398e29ff05bb2ee14 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 5 Apr 2018 17:02:43 +0100 Subject: [PATCH] Update to new join policy API (#636) --- src/base-apis.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/base-apis.js b/src/base-apis.js index eca3c0ca9..915e2441d 100644 --- a/src/base-apis.js +++ b/src/base-apis.js @@ -445,15 +445,22 @@ MatrixBaseApis.prototype.setGroupProfile = function(groupId, profile) { /** * @param {string} groupId - * @param {boolean} isJoinable whether anyone can join the group or only those who - * are invited. + * @param {object} policy The join policy for the group. Must include at + * least a 'type' field which is 'open' if anyone can join the group + * the group without prior approval, or 'invite' if an invite is + * required to join. * @return {module:client.Promise} Resolves: Empty object * @return {module:http-api.MatrixError} Rejects: with an error response. */ -MatrixBaseApis.prototype.setGroupJoinable = function(groupId, isJoinable) { - const path = utils.encodeUri("/groups/$groupId/joinable", {$groupId: groupId}); +MatrixBaseApis.prototype.setGroupJoinPolicy = function(groupId, policy) { + const path = utils.encodeUri( + "/groups/$groupId/settings/m.join_policy", + {$groupId: groupId}, + ); return this._http.authedRequest( - undefined, "PUT", path, undefined, { joinable: isJoinable }, + undefined, "PUT", path, undefined, { + 'm.join_policy': policy, + }, ); };