mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
regression polls could not be closed properly
This commit is contained in:
parent
660d5e0a35
commit
b7f58fe880
@ -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]) {
|
||||
|
@ -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"))
|
||||
|
Loading…
Reference in New Issue
Block a user