diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 65f0686..44fc619 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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