Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
liberty
host
Smilodon
Commits
ff21ff14
Commit
ff21ff14
authored
Nov 30, 2016
by
Eugen Rochko
Browse files
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
parent
872a3501
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/controllers/application_controller.rb
View file @
ff21ff14
...
...
@@ -14,6 +14,7 @@ class ApplicationController < ActionController::Base
before_action
:store_current_location
,
except: :raise_not_found
,
unless: :devise_controller?
before_action
:set_locale
before_action
:set_user_activity
def
raise_not_found
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?
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
def
not_found
...
...
app/helpers/stream_entries_helper.rb
View file @
ff21ff14
...
...
@@ -6,7 +6,7 @@ module StreamEntriesHelper
end
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
def
entry_classes
(
status
,
is_predecessor
,
is_successor
,
include_threads
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment