FIX: Staff should be able to updates polls when edit window expires.

https://meta.discourse.org/t/moderators-cannot-remove-polls-from-posts/81804/7?u=tgxworld
This commit is contained in:
Guo Xiang Tan
2018-03-08 16:45:06 +08:00
parent 10d6101eae
commit b77553a635
2 changed files with 22 additions and 5 deletions

View File

@ -297,6 +297,21 @@ describe DiscoursePoll::PollsUpdater do
context "staff" do
let(:another_user) { Fabricate(:user) }
before do
another_post.update_attributes!(last_editor_id: User.staff.first.id)
end
it "should allow staff to add polls" do
message = MessageBus.track_publish do
described_class.update(another_post, two_polls)
end.first
expect(another_post.errors.full_messages).to eq([])
expect(message.data[:post_id]).to eq(another_post.id)
expect(message.data[:polls]).to eq(two_polls)
end
it "should not allow staff to add options if votes have been casted" do
another_post.update_attributes!(last_editor_id: User.staff.first.id)