From 964d01cd31ab87b12930c76a55a047866a527c4e Mon Sep 17 00:00:00 2001 From: Thibault Farnier Date: Fri, 8 Sep 2017 09:46:56 +0200 Subject: [PATCH] Fix API for unbanning and kicking Signed-off-by: Thibault Farnier --- MatrixSDK/MXRestClient.m | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/MatrixSDK/MXRestClient.m b/MatrixSDK/MXRestClient.m index fa698a4206..11a7e2b091 100644 --- a/MatrixSDK/MXRestClient.m +++ b/MatrixSDK/MXRestClient.m @@ -2466,7 +2466,7 @@ - (MXHTTPOperation*)kickUser:(NSString*)userId [userId stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; - parameters[@"membership"] = @"leave"; + parameters[@"membership"] = @"kick"; if (reason) { @@ -2536,8 +2536,14 @@ - (MXHTTPOperation*)unbanUser:(NSString*)userId success:(void (^)())success failure:(void (^)(NSError *error))failure { - // Do an unban by resetting the user membership to "leave" - return [self kickUser:userId fromRoom:roomId reason:nil success:success failure:failure]; + NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; + parameters[@"user_id"] = userId; + + return [self doMembershipRequest:roomId + membership:@"unban" + parameters:parameters + success:success + failure:failure]; } - (MXHTTPOperation*)createRoom:(NSString*)name