Moved screenshots_visible_to_user to model

This commit is contained in:
Christoph Haas 2016-04-06 16:41:38 +02:00
parent 1cc189ccdc
commit ba5a89a26a
3 changed files with 12 additions and 13 deletions

View file

@ -1,13 +1,2 @@
module PackagesHelper
# Return a query of all screenshots that the current user may see
# Consists of:
# - approved (public) screenshots
# - screenshots uploaded by the user (determined by cookie session)
def screenshots_visible_to_user
self.screenshots.where(
# "approved=true"
"approved=true OR uploaderhash=?", session[:token]
)
end
end