Dropdown on details page allows image management for users and admins

This commit is contained in:
Christoph Haas 2016-04-07 17:01:00 +02:00
parent 263f6cd33f
commit 16999260ca
8 changed files with 75 additions and 35 deletions

View file

@ -36,15 +36,4 @@ class Package < ActiveRecord::Base
def self.screenshots_approved
self.screenshots.find_by(approved: true)
end
# 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(token)
self.screenshots.where(
# "approved=true"
"approved=true OR uploaderhash=?", token
)
end
end