# Moderators cannot remove polls from posts

**URL:** https://meta.discourse.org/t/moderators-cannot-remove-polls-from-posts/81804
**Category:** Bug
**Created:** [February 28, 2018, 5:41pm UTC](https://meta.discourse.org/t/moderators-cannot-remove-polls-from-posts/81804 "2018-02-28T17:41:03Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Lilly\_S](https://avatars.discourse-cdn.com/v4/letter/l/b5ac83/32.png) [@Lilly\_S](https://meta.discourse.org/u/Lilly_S)
#### Post date: [February 28, 2018, 5:41pm UTC](https://meta.discourse.org/t/moderators-cannot-remove-polls-from-posts/81804/1 "2018-02-28T17:41:03Z")

</div>

Hi all,

I searched and saw [some discussion](https://meta.discourse.org/t/polls-cant-be-altered-even-by-moderators-after-5-minutes/13393) on this, but it seems no solution exists (and the topic was more about edited polls rather than removing them).

On our forum, we’ve come across an interesting scenario in which a user no longer wants a poll in their post. This is because they are changing the format of the post from a feature request into a support inquiry. They’re not able to delete the poll in their post, so they flagged it asking for moderators to do so… and then I discovered that moderators cannot either. I get a message saying “You cannot add, remove or rename polls after the first 5 minutes” instead.

Is there a permission to allow moderators to remove polls from posts? If not, can this be implemented/enabled?

Thanks  
Lilly

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [February 28, 2018, 10:33pm UTC](https://meta.discourse.org/t/moderators-cannot-remove-polls-from-posts/81804/2 "2018-02-28T22:33:39Z")

</div>

Oh … moderators should be allowed to unconditionally remove polls from posts, can you send an email to [team@discourse.org](mailto:team@discourse.org) linking to the problem post?

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [March 6, 2018, 10:46pm UTC](https://meta.discourse.org/t/moderators-cannot-remove-polls-from-posts/81804/7 "2018-03-06T22:46:15Z")

</div>

After testing (thanks for the link @Lilly_S) I can confirm that the `poll edit window mins` appears to apply to site staff in addition to regular users. Further, the `poll edit window mins` appears to prevent removal of polls in addition to edits. I think we should:

1. Ensure that staff are not affected by the `poll edit window mins` site setting.
2. Ensure that `poll edit window mins` only applies to edits, so regular users can remove polls even after the poll edit window.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [March 6, 2018, 11:21pm UTC](https://meta.discourse.org/t/moderators-cannot-remove-polls-from-posts/81804/8 "2018-03-06T23:21:32Z")

</div>

@tgxworld looking at the git blame here, it looks like you authored most of the security checks there.

I can also see: `if User.staff.pluck(:id).include?(post.last_editor_id)` which we probably want to change to `if User.staff.where(id: post.last_editor_id).exists?` or something 🙂

I can see that staff are denied option changes after edit window, but should they also be denied complete poll removal?

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [March 8, 2018, 8:53am UTC](https://meta.discourse.org/t/moderators-cannot-remove-polls-from-posts/81804/10 "2018-03-08T08:53:48Z")

</div>

> [@sam](#):
>
> looking at the git blame here, it looks like you authored most of the security checks there.

haha this is because all the code [used to be in `plugin.rb`](https://github.com/discourse/discourse/commit/a849fae5ee86470600c161787e1e7f336b784ca9#diff-a5be6631e5f8a22fc8b6cd7b6a3ac1cd) and I re-organized the code into individual files during a refactor so every line is going to point at me XD

> [@jomaxro](#):
>
> Ensure that staff are not affected by the poll edit window mins site setting.

Fixed in

[https://github.com/discourse/discourse/commit/b77553a6356fa11dfdac6e40bd617dfb752e3a81](https://github.com/discourse/discourse/commit/b77553a6356fa11dfdac6e40bd617dfb752e3a81)

> [@jomaxro](#):
>
> Ensure that poll edit window mins only applies to edits, so regular users can remove polls even after the poll edit window.

I’m not sure about this because we had specific guards in place to prevent this. It has been 2 years since the guards were added but maybe @zogstrip would remember why we did so?

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [March 8, 2018, 10:29pm UTC](https://meta.discourse.org/t/moderators-cannot-remove-polls-from-posts/81804/11 "2018-03-08T22:29:37Z")

</div>

> [@tgxworld](#):
>
> we had specific guards in place to prevent this

Mostly because of the way it was designed in its initial version. More details in

> [@Polls can't be altered (even by Moderators) after 5 minutes?](https://meta.discourse.org/t/polls-cant-be-altered-even-by-moderators-after-5-minutes/13393):
>
> Is this a setting somewhere? As I think moderators/staff should be able to alter a poll regardless of the time limit. What if a regular user creates a poll that is “unfitting” or one of the options isn’t permitted by forum rules?

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [March 14, 2018, 3:06am UTC](https://meta.discourse.org/t/moderators-cannot-remove-polls-from-posts/81804/12 "2018-03-14T03:06:14Z")

</div>

> [@jomaxro](#):
>
> Ensure that poll edit window mins only applies to edits, so regular users can remove polls even after the poll edit window.

Regarding this, I don’t know why the edit window was being applied to the additional/removal and rename of polls because a user should be free to edit his own post. I’ve removed the guard in

[https://github.com/discourse/discourse/commit/51657d34268ded884afd2beab7306125bae5fa66](https://github.com/discourse/discourse/commit/51657d34268ded884afd2beab7306125bae5fa66)

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [March 16, 2018, 1:25am UTC](https://meta.discourse.org/t/moderators-cannot-remove-polls-from-posts/81804/13 "2018-03-16T01:25:56Z")

</div>


