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