1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-29 16:43:09 +03:00

Fixed setPresence opts

This commit is contained in:
Will Hunt
2016-08-11 13:37:53 +01:00
parent 02de5e96ba
commit 1bd5d12665
2 changed files with 5 additions and 5 deletions

View File

@@ -1430,17 +1430,16 @@ MatrixClient.prototype.setPresence = function(opts, callback) {
$userId: this.credentials.userId
});
var content;
if (typeof opts === "string") {
content = { presence: opts }
opts = { presence: opts }
}
var validStates = ["offline", "online", "unavailable"];
if (validStates.indexOf(content.presence) == -1) {
throw new Error("Bad presence value: " + content.presence);
if (validStates.indexOf(opts.presence) == -1) {
throw new Error("Bad presence value: " + opts.presence);
}
return this._http.authedRequest(
callback, "PUT", path, undefined, content
callback, "PUT", path, undefined, opts
);
};