safety check

This commit is contained in:
Christoph Haas 2026-02-26 00:28:00 +01:00
parent d5e0f83c54
commit 0669198233

View file

@ -219,7 +219,7 @@ class PackagesController < ApplicationController
# Increase the rejection counter for the user (social scoring) # Increase the rejection counter for the user (social scoring)
# if the screenshot is new and pending approval # if the screenshot is new and pending approval
unless @screenshot.approved if !@screenshot.approved && @screenshot.user
@screenshot.user.rejected_screenshots += 1 @screenshot.user.rejected_screenshots += 1
@screenshot.user.save! @screenshot.user.save!
end end
@ -243,9 +243,11 @@ class PackagesController < ApplicationController
auditlog 'Screenshot approved', auditlog 'Screenshot approved',
package: @screenshot.package, screenshot: @screenshot package: @screenshot.package, screenshot: @screenshot
# Increase the approval counter for the user (social scoring) if @screenshot.user
@screenshot.user.approved_screenshots += 1 # Increase the approval counter for the user (social scoring)
@screenshot.user.save! @screenshot.user.approved_screenshots += 1
@screenshot.user.save!
end
flash['notice'] = 'Screenshot approved.' flash['notice'] = 'Screenshot approved.'
redirect_back(fallback_location: package_path(name: @screenshot.package.name)) redirect_back(fallback_location: package_path(name: @screenshot.package.name))