2019-05-02 18:17:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-05-02 20:12:19 -04:00
|
|
|
module Jobs
|
|
|
|
|
2019-10-02 00:01:53 -04:00
|
|
|
class ClosePoll < ::Jobs::Base
|
2018-05-02 20:12:19 -04:00
|
|
|
|
|
|
|
def execute(args)
|
2018-12-13 03:39:36 -05:00
|
|
|
%i{
|
|
|
|
post_id
|
|
|
|
poll_name
|
|
|
|
}.each do |key|
|
|
|
|
raise Discourse::InvalidParameters.new(key) if args[key].blank?
|
|
|
|
end
|
|
|
|
|
|
|
|
DiscoursePoll::Poll.toggle_status(
|
|
|
|
args[:post_id],
|
|
|
|
args[:poll_name],
|
|
|
|
"closed",
|
2018-12-17 09:28:57 -05:00
|
|
|
Discourse.system_user,
|
|
|
|
false
|
2018-12-13 03:39:36 -05:00
|
|
|
)
|
2018-05-02 20:12:19 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|