mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-20 12:04:19 -05:00
Use /rooms/$room_id/state/m.room.member/$user_id to change the membership of another user
This commit is contained in:
parent
8a7c1d6a00
commit
5dd1a738f8
@ -166,12 +166,24 @@ angular.module('matrixService', [])
|
|||||||
return doRequest("POST", path, undefined, data);
|
return doRequest("POST", path, undefined, data);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Change the membership of an another user
|
||||||
|
setMembership: function(room_id, user_id, membershipValue) {
|
||||||
|
// The REST path spec
|
||||||
|
var path = "/rooms/$room_id/state/m.room.member/$user_id";
|
||||||
|
path = path.replace("$room_id", encodeURIComponent(room_id));
|
||||||
|
path = path.replace("$user_id", user_id);
|
||||||
|
|
||||||
|
return doRequest("PUT", path, undefined, {
|
||||||
|
membership: membershipValue
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
// Bans a user from from a room
|
// Bans a user from from a room
|
||||||
ban: function(room_id, user_id, reason) {
|
ban: function(room_id, user_id, reason) {
|
||||||
var path = "/rooms/$room_id/ban/";
|
var path = "/rooms/$room_id/ban/";
|
||||||
path = path.replace("$room_id", encodeURIComponent(room_id));
|
path = path.replace("$room_id", encodeURIComponent(room_id));
|
||||||
|
|
||||||
return doRequest("PUT", path, undefined, {
|
return doRequest("POST", path, undefined, {
|
||||||
user_id: user_id,
|
user_id: user_id,
|
||||||
reason: reason
|
reason: reason
|
||||||
});
|
});
|
||||||
|
@ -289,7 +289,7 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput'])
|
|||||||
var user_id = args[1];
|
var user_id = args[1];
|
||||||
|
|
||||||
// Set his state in the room as leave
|
// Set his state in the room as leave
|
||||||
promise = matrixService.membershipChange($scope.room_id, user_id, "leave");
|
promise = matrixService.setMembership($scope.room_id, user_id, "leave");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -314,7 +314,7 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput'])
|
|||||||
var user_id = args[1];
|
var user_id = args[1];
|
||||||
|
|
||||||
// Reset the user membership to leave to unban him
|
// Reset the user membership to leave to unban him
|
||||||
promise = matrixService.membershipChange($scope.room_id, user_id, "leave");
|
promise = matrixService.setMembership($scope.room_id, user_id, "leave");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user