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

Merge pull request #1071 from matrix-org/travis/new-deactivate

Check the right Synapse endpoint for determining admin capabilities
This commit is contained in:
Travis Ralston
2019-11-15 09:17:12 -07:00
committed by GitHub

View File

@@ -4278,9 +4278,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: this.getUserId() },
);
return this._http.authedRequest(
undefined, 'GET', path, undefined, undefined, {prefix: ''},
).then(r => r['admin']); // pull out the specific boolean we want
};
/**