mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-11-26 16:44:48 +00:00
Make User#current_sign_in_at actually track when user was last active,
by updating it at least every 24h if the user visits the site
This commit is contained in:
parent
872a35011a
commit
ff21ff1489
|
@ -14,6 +14,7 @@ class ApplicationController < ActionController::Base
|
||||||
|
|
||||||
before_action :store_current_location, except: :raise_not_found, unless: :devise_controller?
|
before_action :store_current_location, except: :raise_not_found, unless: :devise_controller?
|
||||||
before_action :set_locale
|
before_action :set_locale
|
||||||
|
before_action :set_user_activity
|
||||||
|
|
||||||
def raise_not_found
|
def raise_not_found
|
||||||
raise ActionController::RoutingError, "No route matches #{params[:unmatched_route]}"
|
raise ActionController::RoutingError, "No route matches #{params[:unmatched_route]}"
|
||||||
|
@ -35,6 +36,10 @@ class ApplicationController < ActionController::Base
|
||||||
redirect_to root_path unless current_user&.admin?
|
redirect_to root_path unless current_user&.admin?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def set_user_activity
|
||||||
|
current_user.touch(:current_sign_in_at) if !current_user.nil? && current_user.current_sign_in_at < 24.hours.ago
|
||||||
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def not_found
|
def not_found
|
||||||
|
|
|
@ -6,7 +6,7 @@ module StreamEntriesHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def avatar_for_status_url(status)
|
def avatar_for_status_url(status)
|
||||||
status.reblog? ? status.reblog.account.avatar.url(:medium) : status.account.avatar.url(:medium)
|
status.reblog? ? status.reblog.account.avatar.url(:large) : status.account.avatar.url(:large)
|
||||||
end
|
end
|
||||||
|
|
||||||
def entry_classes(status, is_predecessor, is_successor, include_threads)
|
def entry_classes(status, is_predecessor, is_successor, include_threads)
|
||||||
|
|
Loading…
Reference in a new issue