mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 13:11:18 +08:00
FEATURE: Allow users to remove their vote (#14459)
They can use the remove vote button or select the same option again for single choice polls. This commit refactor the plugin to properly organize code and make it easier to follow.
This commit is contained in:
@ -185,7 +185,7 @@ describe PostsController do
|
||||
end
|
||||
|
||||
it "resets the votes" do
|
||||
DiscoursePoll::Poll.vote(post_id, "poll", ["5c24fc1df56d764b550ceae1b9319125"], user)
|
||||
DiscoursePoll::Poll.vote(user, post_id, "poll", ["5c24fc1df56d764b550ceae1b9319125"])
|
||||
|
||||
put :update, params: {
|
||||
id: post_id, post: { raw: "[poll]\n- A\n- B\n- C\n[/poll]" }
|
||||
@ -244,7 +244,7 @@ describe PostsController do
|
||||
describe "with at least one vote" do
|
||||
|
||||
before do
|
||||
DiscoursePoll::Poll.vote(post_id, "poll", ["5c24fc1df56d764b550ceae1b9319125"], user)
|
||||
DiscoursePoll::Poll.vote(user, post_id, "poll", ["5c24fc1df56d764b550ceae1b9319125"])
|
||||
end
|
||||
|
||||
it "cannot change the options" do
|
||||
|
Reference in New Issue
Block a user