mirror of
https://github.com/discourse/discourse.git
synced 2025-03-25 04:05:35 +08:00
FIX: auto-closing poll wasn't working
This commit is contained in:
parent
c38f7b240b
commit
5142911012
@ -3,7 +3,7 @@ module Jobs
|
||||
class ClosePoll < Jobs::Base
|
||||
|
||||
def execute(args)
|
||||
DiscoursePoll::Poll.toggle_status(args[:post_id], args[:poll_name], "closed", -1)
|
||||
DiscoursePoll::Poll.toggle_status(args[:post_id], args[:poll_name], "closed", Discourse.system_user)
|
||||
end
|
||||
|
||||
end
|
||||
|
15
plugins/poll/spec/jobs/regular/close_poll_spec.rb
Normal file
15
plugins/poll/spec/jobs/regular/close_poll_spec.rb
Normal file
@ -0,0 +1,15 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe Jobs::ClosePoll do
|
||||
|
||||
it "automatically closes a poll" do
|
||||
post = Fabricate(:post, raw: "[poll]\n- A\n- B\n[/poll]")
|
||||
|
||||
expect(post.polls.first.closed?).to eq(false)
|
||||
|
||||
Jobs::ClosePoll.new.execute(post_id: post.id, poll_name: "poll")
|
||||
|
||||
expect(post.polls.first.closed?).to eq(true)
|
||||
end
|
||||
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user