Working on query to only display moderated or own uploads
This commit is contained in:
parent
5147497d3f
commit
53b297da1e
1 changed files with 18 additions and 0 deletions
|
|
@ -31,4 +31,22 @@ class Package < ActiveRecord::Base
|
||||||
subselect = Screenshot.select(:package_id)
|
subselect = Screenshot.select(:package_id)
|
||||||
where.not(id: subselect)
|
where.not(id: subselect)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Return a query of all approved/public screenshots of this package
|
||||||
|
def self.query_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)
|
||||||
|
working on it…
|
||||||
|
def self.query_visible_to_user
|
||||||
|
approved_screenshots = Screenshot.find_by()
|
||||||
|
|
||||||
|
subselect = Screenshot.select(:package_id)
|
||||||
|
where.not(id: subselect)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue