discourse/plugins/poll/jobs/regular/close_poll.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

27 lines
431 B
Ruby
Raw Normal View History

# frozen_string_literal: true
module Jobs
class ClosePoll < ::Jobs::Base
def execute(args)
%i{
post_id
poll_name
}.each do |key|
raise Discourse::InvalidParameters.new(key) if args[key].blank?
end
DiscoursePoll::Poll.toggle_status(
Discourse.system_user,
args[:post_id],
args[:poll_name],
"closed",
2018-12-17 22:28:57 +08:00
false
)
end
end
end