mirror of
https://ghfast.top/https://github.com/discourse/discourse-topic-voting.git
synced 2026-07-16 11:26:36 +08:00
16 lines
436 B
Ruby
16 lines
436 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Jobs
|
|
module DiscourseTopicVoting
|
|
class VoteReclaim < ::Jobs::Base
|
|
def execute(args)
|
|
if topic = Topic.with_deleted.find_by(id: args[:topic_id])
|
|
ActiveRecord::Base.transaction do
|
|
::DiscourseTopicVoting::Vote.where(topic_id: args[:topic_id]).update_all(archive: false)
|
|
topic.update_vote_count
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|