diff --git a/app/controllers/packages_controller.rb b/app/controllers/packages_controller.rb index 2d29940..b242467 100644 --- a/app/controllers/packages_controller.rb +++ b/app/controllers/packages_controller.rb @@ -219,7 +219,7 @@ class PackagesController < ApplicationController # Increase the rejection counter for the user (social scoring) # if the screenshot is new and pending approval - unless @screenshot.approved + if !@screenshot.approved && @screenshot.user @screenshot.user.rejected_screenshots += 1 @screenshot.user.save! end @@ -243,9 +243,11 @@ class PackagesController < ApplicationController auditlog 'Screenshot approved', package: @screenshot.package, screenshot: @screenshot - # Increase the approval counter for the user (social scoring) - @screenshot.user.approved_screenshots += 1 - @screenshot.user.save! + if @screenshot.user + # Increase the approval counter for the user (social scoring) + @screenshot.user.approved_screenshots += 1 + @screenshot.user.save! + end flash['notice'] = 'Screenshot approved.' redirect_back(fallback_location: package_path(name: @screenshot.package.name))