Moderators cannot remove polls from posts

Hi all,

I searched and saw some discussion 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

4 Likes

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

4 Likes

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.
1 Like

@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 :slight_smile:

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

3 Likes

haha this is because all the code used to be in plugin.rb and I re-organized the code into individual files during a refactor so every line is going to point at me XD

Fixed in

https://github.com/discourse/discourse/commit/b77553a6356fa11dfdac6e40bd617dfb752e3a81

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?

5 Likes

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

4 Likes

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

7 Likes