1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-19 16:42:09 +03:00

Fire presence first time if presence event unset.

This commit is contained in:
Kegan Dougal
2015-07-20 11:28:13 +01:00
parent 32c4d3ffc4
commit 93a104fe4c
2 changed files with 3 additions and 1 deletions

View File

@@ -45,10 +45,11 @@ User.prototype.setPresenceEvent = function(event) {
if (event.getType() !== "m.presence") {
return;
}
var firstFire = this.events.presence === null;
this.events.presence = event;
var eventsToFire = [];
if (event.getContent().presence !== this.presence) {
if (event.getContent().presence !== this.presence || firstFire) {
eventsToFire.push("User.presence");
}
if (event.getContent().avatar_url !== this.avatarUrl) {