1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-25 05:23:13 +03:00

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.
This commit is contained in:
Luke Barnard
2018-03-29 17:03:20 +01:00
committed by GitHub
parent d53cd41aa6
commit 1afaf903f9

View File

@@ -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 * @param {string} groupId
* @return {module:client.Promise} Resolves: Group users list object * @return {module:client.Promise} Resolves: Group users list object