This commit is contained in:
Christoph Haas 2021-02-20 21:18:29 +01:00
parent 9bd01ff30b
commit aaf22a34fb

View file

@ -16,17 +16,12 @@ class PackagesController < ApplicationController
end
def details
# TODO: Get only screenshots visible to the user (admin or owner or approved)
@package = Package.find_by(name: params[:name])
if @package.nil?
@packagename = params[:name]
render 'notfound', status: 404
else
# The first page of screenshots (if there are multiple at all) shows the
# first image twice as large. So the first page contains 5 images while
# the second and further page contain 6 images.
@page = params[:page]
@screenshots = screenshots_visible_to_user(@package).paginate(page: @page, per_page: 6)
end