FEATURE: Stricter rules for user presence

Previously we would consider a user "present" and "last seen" if the
browser window was visible.

This has many edge cases, you could be considered present and around for
days just by having a window open and no screensaver on.

Instead we now also check that you either clicked, transitioned around app
or scrolled the page in the last minute in combination with window
visibility

This will lead to more reliable notifications via email and reduce load of
message bus for cases where a user walks away from the terminal
This commit is contained in:
Sam Saffron
2020-03-26 17:35:32 +11:00
parent 6f978bc95c
commit 25f1f23288
11 changed files with 69 additions and 18 deletions

View File

@ -251,7 +251,7 @@ class Auth::DefaultCurrentUserProvider
api = !!(@env[API_KEY_ENV]) || !!(@env[USER_API_KEY_ENV])
if @request.xhr? || api
@env["HTTP_DISCOURSE_VISIBLE".freeze] == "true".freeze
@env["HTTP_DISCOURSE_PRESENT"] == "true"
else
true
end