mirror of
https://github.com/discourse/discourse.git
synced 2024-12-24 09:03:47 +08:00
20 lines
404 B
Ruby
20 lines
404 B
Ruby
# 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",
|
|
false,
|
|
)
|
|
end
|
|
end
|
|
end
|