jobs: migrate mass updates to ActiveJob.

Also fixes a bug where mod actions weren't logged on mass updates.
Creating the mod action silently failed because it was called when
CurrentUser wasn' set.
This commit is contained in:
evazion
2019-08-19 00:46:31 -05:00
parent 48488d04db
commit dab43d96c9
7 changed files with 144 additions and 162 deletions

View File

@@ -1,13 +1,12 @@
module Moderator
class TagsController < ApplicationController
before_action :moderator_only
rescue_from TagBatchChange::Error, :with => :error
def edit
end
def update
Delayed::Job.enqueue(TagBatchChange.new(params[:tag][:antecedent], params[:tag][:consequent], CurrentUser.user.id, CurrentUser.ip_addr), :queue => "default")
TagBatchChangeJob.perform_later(params[:tag][:antecedent], params[:tag][:consequent], CurrentUser.user, CurrentUser.ip_addr)
redirect_to edit_moderator_tag_path, :notice => "Post changes queued"
end