Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the unban method #364

Merged
merged 1 commit into from
Feb 13, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -1380,13 +1380,23 @@ MatrixClient.prototype.forget = function(roomId, deleteRoom, callback) {
* @param {string} roomId
* @param {string} userId
* @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.
*/
MatrixClient.prototype.unban = function(roomId, userId, callback) {
// unbanning = set their state to leave
return _setMembershipState(
this, roomId, userId, "leave", undefined, callback,
// unbanning != set their state to leave: this used to be
// the case, but was then changed so that leaving was always
// 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,
);
};

Expand Down