mirror of
https://github.com/element-hq/element-web
synced 2024-11-24 02:05:45 +03:00
Don't reset the presence timer on every dispatch
Only on user activity (there's now a dispatch every time we set a member event, ie. A LOT, hence this now being a problem)
This commit is contained in:
parent
d167dbcf86
commit
a97e7375d5
1 changed files with 6 additions and 4 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
Copyright 2015, 2016 OpenMarket Ltd
|
||||
Copyright 2018 New Vector Ltd
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
@ -31,7 +32,7 @@ class Presence {
|
|||
this.running = true;
|
||||
if (undefined === this.state) {
|
||||
this._resetTimer();
|
||||
this.dispatcherRef = dis.register(this._onUserActivity.bind(this));
|
||||
this.dispatcherRef = dis.register(this._onAction.bind(this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -125,10 +126,11 @@ class Presence {
|
|||
this.setState("unavailable");
|
||||
}
|
||||
|
||||
_onUserActivity(payload) {
|
||||
if (payload.action === "sync_state" || payload.action === "self_presence_updated") return;
|
||||
_onAction(payload) {
|
||||
if (payload.action === "user_activity") {
|
||||
this._resetTimer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback called when the user made an action on the page
|
||||
|
|
Loading…
Reference in a new issue