Skip to content

Commit

Permalink
Merge pull request #367 from ThibaultFarnier/feature/fix_unban_and_kick
Browse files Browse the repository at this point in the history
Fix API for unbanning and kicking
(Fix element-hq/element-ios#1170)
  • Loading branch information
giomfo authored Sep 8, 2017
2 parents 2285763 + 964d01c commit e4f491b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions MatrixSDK/MXRestClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -2466,7 +2466,7 @@ - (MXHTTPOperation*)kickUser:(NSString*)userId
[userId stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];

NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
parameters[@"membership"] = @"leave";
parameters[@"membership"] = @"kick";

if (reason)
{
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e4f491b

Please sign in to comment.