You've already forked matrix-js-sdk
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:
@@ -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
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user