1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-12-01 04:43:29 +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 $userId: this.credentials.userId
}); });
var content;
if (typeof opts === "string") { if (typeof opts === "string") {
content = { presence: opts } opts = { presence: opts }
} }
var validStates = ["offline", "online", "unavailable"]; var validStates = ["offline", "online", "unavailable"];
if (validStates.indexOf(content.presence) == -1) { if (validStates.indexOf(opts.presence) == -1) {
throw new Error("Bad presence value: " + content.presence); throw new Error("Bad presence value: " + opts.presence);
} }
return this._http.authedRequest( return this._http.authedRequest(
callback, "PUT", path, undefined, content callback, "PUT", path, undefined, opts
); );
}; };

View File

@@ -97,6 +97,7 @@ User.prototype.setPresenceEvent = function(event) {
this.presence = event.getContent().presence; this.presence = event.getContent().presence;
eventsToFire.push("User.lastPresenceTs"); eventsToFire.push("User.lastPresenceTs");
if (event.getContent().status_msg) { if (event.getContent().status_msg) {
this.presenceStatusMsg = event.getContent().status_msg; this.presenceStatusMsg = event.getContent().status_msg;
} }