safety check
This commit is contained in:
parent
d5e0f83c54
commit
0669198233
1 changed files with 6 additions and 4 deletions
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue