You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-29 16:43:09 +03:00
Fix the unban method
Which didn't work because of https://github.com/matrix-org/synapse/issues/1860
This commit is contained in:
@@ -1380,13 +1380,23 @@ MatrixClient.prototype.forget = function(roomId, deleteRoom, callback) {
|
|||||||
* @param {string} roomId
|
* @param {string} roomId
|
||||||
* @param {string} userId
|
* @param {string} userId
|
||||||
* @param {module:client.callback} callback Optional.
|
* @param {module:client.callback} callback Optional.
|
||||||
* @return {module:client.Promise} Resolves: TODO
|
* @return {module:client.Promise} Resolves: Object (currently empty)
|
||||||
* @return {module:http-api.MatrixError} Rejects: with an error response.
|
* @return {module:http-api.MatrixError} Rejects: with an error response.
|
||||||
*/
|
*/
|
||||||
MatrixClient.prototype.unban = function(roomId, userId, callback) {
|
MatrixClient.prototype.unban = function(roomId, userId, callback) {
|
||||||
// unbanning = set their state to leave
|
// unbanning != set their state to leave: this used to be
|
||||||
return _setMembershipState(
|
// the case, but was then changed so that leaving was always
|
||||||
this, roomId, userId, "leave", undefined, callback,
|
// a revoking of priviledge, otherwise two people racing to
|
||||||
|
// kick / ban someone could end up banning and then un-banning
|
||||||
|
// them.
|
||||||
|
const path = utils.encodeUri("/rooms/$roomId/unban", {
|
||||||
|
$roomId: roomId,
|
||||||
|
});
|
||||||
|
const data = {
|
||||||
|
user_id: userId,
|
||||||
|
};
|
||||||
|
return this._http.authedRequest(
|
||||||
|
callback, "POST", path, undefined, data,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user