FIX: Don't update User#last_seen_at when PG is readonly take 2.

This commit is contained in:
Guo Xiang Tan
2019-01-21 13:49:08 +08:00
parent c732ae9ca9
commit 4466fcf1bc
5 changed files with 14 additions and 17 deletions

View File

@ -25,6 +25,7 @@ class Auth::DefaultCurrentUserProvider
# our current user, return nil if none is found
def current_user
return @env[CURRENT_USER_KEY] if @env.key?(CURRENT_USER_KEY)
raise Discourse::ReadOnly if Discourse.pg_readonly_mode?
# bypass if we have the shared session header
if shared_key = @env['HTTP_X_SHARED_SESSION_KEY']
@ -241,8 +242,6 @@ class Auth::DefaultCurrentUserProvider
end
def should_update_last_seen?
return false if Discourse.pg_readonly_mode?
if @request.xhr?
@env["HTTP_DISCOURSE_VISIBLE".freeze] == "true".freeze
elsif !!(@env[API_KEY_ENV]) || !!(@env[USER_API_KEY_ENV])