1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-26 17:03:12 +03:00

incorporate PR feedback

This commit is contained in:
Matthew Hodgson
2016-04-18 14:26:59 +01:00
parent 3af35c8209
commit 0e606c6fe2
2 changed files with 12 additions and 6 deletions

View File

@@ -696,15 +696,12 @@ Room.prototype._addLiveEvent = function(event, duplicateStrategy) {
event.sender.userId, event, "m.read" event.sender.userId, event, "m.read"
), true); ), true);
// also, any live events from a user should be taken as implicit // Any live events from a user could be taken as implicit
// presence information: evidence that they are currently active. // presence information: evidence that they are currently active.
// ...except in a world where we use 'user.currentlyActive' to reduce // ...except in a world where we use 'user.currentlyActive' to reduce
// presence spam, this isn't very useful - we'll get a transition when // presence spam, this isn't very useful - we'll get a transition when
// they are no longer currently active anyway. so comment it out for now. // they are no longer currently active anyway. So don't bother to
// reset the lastActiveAgo and lastPresenceTs from the RoomState's user.
// var user = this.currentState.getMember(events[i].sender.userId);
// user.lastActiveAgo = 0;
// user.lastPresenceTs = Date.now();
} }
}; };

View File

@@ -143,6 +143,15 @@ User.prototype.getLastModifiedTime = function() {
return this._modified; return this._modified;
}; };
/**
* Get the absolute timestamp when this User was last known active on the server.
* It is *NOT* accurate if this.currentlyActive is true.
* @return {number} The timestamp
*/
User.prototype.getLastActiveTs = function() {
return this.lastPresenceTs - this.lastActiveAgo;
};
/** /**
* The User class. * The User class.
*/ */