FIX: Incorrect arguments were being passed to Jobs::ClosePoll.

Also fix spec that wasn't testing anything.
This commit is contained in:
Guo Xiang Tan
2018-12-13 16:39:36 +08:00
parent 939b82ef0c
commit 71ce9ced47
4 changed files with 50 additions and 10 deletions

View File

@@ -3,7 +3,19 @@ module Jobs
class ClosePoll < Jobs::Base
def execute(args)
DiscoursePoll::Poll.toggle_status(args[:post_id], args[:poll_name], "closed", Discourse.system_user)
%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",
Discourse.system_user
)
end
end