From 1afaf903f9677791cda85ceb9233d92f684743a7 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Thu, 29 Mar 2018 17:03:20 +0100 Subject: [PATCH] Add wrapped to set group `is_joinable` (#634) which is exposed in the summary API under `summary.profile.is_joinable`. If true, anyone can join the group. If false, an invite is required. --- src/base-apis.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/base-apis.js b/src/base-apis.js index 1d59d9137..eca3c0ca9 100644 --- a/src/base-apis.js +++ b/src/base-apis.js @@ -443,6 +443,20 @@ MatrixBaseApis.prototype.setGroupProfile = function(groupId, profile) { ); }; +/** + * @param {string} groupId + * @param {boolean} isJoinable whether anyone can join the group or only those who + * are invited. + * @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}); + return this._http.authedRequest( + undefined, "PUT", path, undefined, { joinable: isJoinable }, + ); +}; + /** * @param {string} groupId * @return {module:client.Promise} Resolves: Group users list object