Added moderation, report and approval buttons for admins, uploaders and anonymous people
This commit is contained in:
parent
014a840493
commit
9bb9cf1f5d
5 changed files with 43 additions and 10 deletions
|
|
@ -1,5 +1,5 @@
|
|||
class PackagesController < ApplicationController
|
||||
before_action :authenticate_user!, only: [:moderate]
|
||||
before_action :authenticate_user!, only: [:moderate, :moderate_screenshot]
|
||||
|
||||
def list
|
||||
@packages = query_packages
|
||||
|
|
@ -96,6 +96,28 @@ class PackagesController < ApplicationController
|
|||
@screenshot = Screenshot.find(params[:id])
|
||||
@screenshot.description = params[:description]
|
||||
@screenshot.save!
|
||||
flash['notice'] = "Description updated."
|
||||
redirect_to package_path
|
||||
end
|
||||
|
||||
# Receive an anonymous report from a user to have a screenshot removed.
|
||||
def report_screenshot
|
||||
@screenshot = Screenshot.find(params[:id])
|
||||
@screenshot.delete_reason = params[:delete_reason]
|
||||
@screenshot.markedfordelete = true
|
||||
@screenshot.save!
|
||||
flash['notice'] = "Screenshot reported. The moderators will deal with it."
|
||||
redirect_to package_path
|
||||
end
|
||||
|
||||
# Publish a screenshot from the moderation queue
|
||||
def approve_screenshot
|
||||
@screenshot = Screenshot.find(params[:id])
|
||||
@screenshot.delete_reason = nil
|
||||
@screenshot.markedfordelete = false
|
||||
@screenshot.approved = true
|
||||
@screenshot.save!
|
||||
flash['notice'] = "Screenshot approved."
|
||||
redirect_to package_path
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue