diff --git a/plugins/poll/assets/javascripts/lib/discourse-markdown/poll.js.es6 b/plugins/poll/assets/javascripts/lib/discourse-markdown/poll.js.es6 index 76ebf8cdc18..20b0dee7c3b 100644 --- a/plugins/poll/assets/javascripts/lib/discourse-markdown/poll.js.es6 +++ b/plugins/poll/assets/javascripts/lib/discourse-markdown/poll.js.es6 @@ -113,7 +113,10 @@ const rule = { // default poll attributes const attributes = [["class", "poll"]]; - attributes.push([DATA_PREFIX + "status", "open"]); + + if (!attrs['status']) { + attributes.push([DATA_PREFIX + "status", "open"]); + } WHITELISTED_ATTRIBUTES.forEach(name => { if (attrs[name]) { diff --git a/plugins/poll/spec/controllers/polls_controller_spec.rb b/plugins/poll/spec/controllers/polls_controller_spec.rb index 9e8e0196443..677a72d6098 100644 --- a/plugins/poll/spec/controllers/polls_controller_spec.rb +++ b/plugins/poll/spec/controllers/polls_controller_spec.rb @@ -79,8 +79,8 @@ describe ::DiscoursePoll::PollsController do end it "ensures poll is open" do - closed_poll = Fabricate(:post, raw: "[poll status=closed]\n- A\n- B\n[/poll]") - xhr :put, :vote, { post_id: closed_poll.id, poll_name: "poll", options: ["A"] } + closed_poll = create_post(raw: "[poll status=closed]\n- A\n- B\n[/poll]") + xhr :put, :vote, { post_id: closed_poll.id, poll_name: "poll", options: ["5c24fc1df56d764b550ceae1b9319125"] } expect(response).not_to be_success json = ::JSON.parse(response.body) expect(json["errors"][0]).to eq(I18n.t("poll.poll_must_be_open_to_vote"))