Added per-user counter of approved/rejected screenshots
This commit is contained in:
parent
c97a711e6b
commit
9635b3968c
5 changed files with 55 additions and 27 deletions
|
|
@ -220,6 +220,14 @@ class PackagesController < ApplicationController
|
|||
auditlog "Screenshot #{@screenshot.id} deleted",
|
||||
package: @screenshot.package
|
||||
@screenshot.destroy
|
||||
|
||||
# Increase the rejection counter for the user (social scoring)
|
||||
# if the screenshot is new and pending approval
|
||||
if !@screenshot.approved
|
||||
@screenshot.user.rejected_screenshots += 1
|
||||
@screenshot.user.save!
|
||||
end
|
||||
|
||||
flash['notice'] = "Screenshot deleted."
|
||||
redirect_back(fallback_location: package_path(name: @screenshot.package.name))
|
||||
else
|
||||
|
|
@ -234,6 +242,11 @@ class PackagesController < ApplicationController
|
|||
@screenshot.approve!
|
||||
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!
|
||||
|
||||
flash['notice'] = "Screenshot approved."
|
||||
redirect_back(fallback_location: package_path(name: @screenshot.package.name))
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue