Remove vote functionality from `Ajax::ModerationController`
This commit is contained in:
parent
4ab391a09e
commit
43af4acb2c
|
@ -3,47 +3,6 @@ require 'use_case/user/unban'
|
||||||
require 'errors'
|
require 'errors'
|
||||||
|
|
||||||
class Ajax::ModerationController < AjaxController
|
class Ajax::ModerationController < AjaxController
|
||||||
def vote
|
|
||||||
params.require :id
|
|
||||||
params.require :upvote
|
|
||||||
|
|
||||||
report = Report.find(params[:id])
|
|
||||||
|
|
||||||
begin
|
|
||||||
current_user.report_vote(report, params[:upvote])
|
|
||||||
rescue => e
|
|
||||||
Sentry.capture_exception(e)
|
|
||||||
@response[:status] = :fail
|
|
||||||
@response[:message] = t(".error")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
@response[:count] = report.votes
|
|
||||||
@response[:status] = :okay
|
|
||||||
@response[:message] = t(".success")
|
|
||||||
@response[:success] = true
|
|
||||||
end
|
|
||||||
|
|
||||||
def destroy_vote
|
|
||||||
params.require :id
|
|
||||||
|
|
||||||
report = Report.find(params[:id])
|
|
||||||
|
|
||||||
begin
|
|
||||||
current_user.report_unvote report
|
|
||||||
rescue => e
|
|
||||||
Sentry.capture_exception(e)
|
|
||||||
@response[:status] = :fail
|
|
||||||
@response[:message] = t(".error")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
@response[:count] = report.votes
|
|
||||||
@response[:status] = :okay
|
|
||||||
@response[:message] = t(".success")
|
|
||||||
@response[:success] = true
|
|
||||||
end
|
|
||||||
|
|
||||||
def destroy_report
|
def destroy_report
|
||||||
params.require :id
|
params.require :id
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue