Dropdown on details page allows image management for users and admins
This commit is contained in:
parent
263f6cd33f
commit
16999260ca
8 changed files with 75 additions and 35 deletions
|
|
@ -1,2 +1,19 @@
|
|||
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)
|
||||
# - all screenshots if the user is logged in
|
||||
def screenshots_visible_to_user(package)
|
||||
if user_signed_in?
|
||||
# User is an admin
|
||||
package.screenshots
|
||||
else
|
||||
package.screenshots.where(
|
||||
"approved=true OR uploaderhash=?", session[:token]
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue