Link to packages and screenshots (highlighted) from logs view

This commit is contained in:
Christoph Haas 2021-03-06 20:47:33 +01:00
parent 9a16bad007
commit 330536cb7e
4 changed files with 17 additions and 4 deletions

View file

@ -18,6 +18,12 @@ class PackagesController < ApplicationController
def details
@package = Package.find_by(name: params[:name])
# Highlight a certain screenshot (by ID). This is used by the logs.slim
# view to link to a certain screenshot of a package.
if params[:highlight]
@highlight_id = params[:highlight].to_i
end
if @package.nil?
@packagename = params[:name]
render 'notfound', status: 404
@ -177,7 +183,7 @@ class PackagesController < ApplicationController
# Check if the user is allowed to change this screenshot
# - Is this the user's own screenshot? (anonymous)
if (@screenshot.user == current_user) || (can? :destroy, @screenshot)
auditlog "Screenshot #{@screenshot} deleted",
auditlog "Screenshot #{@screenshot.id} deleted",
package: @screenshot.package
@screenshot.destroy
flash['notice'] = "Screenshot deleted."