Get screenshots for logged-in as well as anonymous users
This commit is contained in:
parent
b1e8ebd9b4
commit
58ab5f1073
1 changed files with 5 additions and 3 deletions
|
|
@ -10,10 +10,12 @@ class ApplicationController < ActionController::Base
|
|||
before_action :better_errors_hack, if: -> { Rails.env.development? }
|
||||
|
||||
# Query for packages that were uploaded by the current user.
|
||||
# As AAA is not yet implemented it means looking for uploads
|
||||
# that correspond to the user's cookie token.
|
||||
# If the user is anonymous then find the uploads by the cookie token.
|
||||
# If the user is logged in then find the uploads by matching the user id.
|
||||
def get_current_users_screenshots
|
||||
if session[:token]
|
||||
if user_signed_in?
|
||||
@current_users_screenshots = current_user.screenshots
|
||||
else
|
||||
@current_users_screenshots = Screenshot.uploaded_by(session[:token])
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue