1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-26 17:03:12 +03:00

Check the right Synapse endpoint for determining admin capabilities

This commit is contained in:
Travis Ralston
2019-11-14 11:50:06 -07:00
parent fbc4bd0c96
commit bad48da11a

View File

@@ -4021,9 +4021,13 @@ MatrixClient.prototype.isFallbackICEServerAllowed = function() {
* @return {boolean} true if the user appears to be a Synapse administrator.
*/
MatrixClient.prototype.isSynapseAdministrator = function() {
return this.whoisSynapseUser(this.getUserId())
.then(() => true)
.catch(() => false);
const path = utils.encodeUri(
"/_synapse/admin/v1/users/$userId/admin",
{ $userId: userId },
);
return this._http.authedRequest(
undefined, 'GET', path, undefined, undefined, {prefix: ''},
).then(r => r['admin']); // pull out the specific boolean we want
};
/**