Cannot edit post with poll

I believe I have the same issues as in this post, but unfortunately it’s closed.

I have been trying to change some text in this post (and another one which I cannot link to due to new user restrictions), but I get the same error (“You cannot change a poll after the first 5 minutes.”). Please note that I am not editing the poll at all; all I am trying to do is turn some text in the Schedule section of these posts into a link. It doesn’t matter whether the poll is open or closed.

3 Likes

Can we repro this @tshenry?

1 Like

By the way, while this has happened to several users on http://community.wanikani.com recently, other users have been able to edit posts with polls just fine. Is it possible there was a recent bug that has already been resolved, but posts created when the bug existed are stuck in a bad state?

3 Likes

Hmm, I am not able to repro.

I copied the exact markdown from the linked post in the OP to be extra thorough just in case there was some oddly specific edge case. I waited for the 5 minute edit window to expire and tried adding a link to an entry in the Schedule section. It saved without issue.

I guess it’s possible, but I suspect not. You could try to have an admin/mod rebake the post using the “Rebuild HTML” option in the post admin menu to make sure the post is cooked to with all the latest.

I do see a strange diff in the most recent revision history:

It gives the impression there was a change, yet when I look at the raw diff, I see no changes.

The only thing I can think of is there is some weird edge case that can happen when an emoji is used with a poll, but so far I’m not able to prove that out.

3 Likes

Hmm, maybe when the user is making unrelated edits to the post there’s some automatic Discourse change in the poll area that makes it look like a change is being made to the poll itself. Could that happen if some aspect of the Discourse rendering code changed such that it generates different HTML in the poll area now compared to when the post was first made?

Just to double check before I recommend they try this, this won’t reset the poll results like when you edit a poll within the grace period, right?

2 Likes

No, the results are stored in the database and won’t be affected, but given my experience, I don’t think you need to bother. See below.

You’re on to something! If you inspect the HTML of the diff there is a change in the data-poll-option-id of the first option:

That’s all generated behind the scenes, so maybe there is, or was a bug somewhere that caused this to change.

I tried manually changing the data-poll-option-id (stored as digest in PollOption records) and can repro the issue (I’m no longer able to save an edit). If I change it back to its previous value, I can edit normally.

Let me check on a couple more things.

4 Likes

Ok, I have a follow-up on this. I checked with engineering and they narrowed it down to the emoji used in the poll. Its image source ended up changing in the cooked post value which put things into a bit of an odd state. The emoji source shouldn’t be changing very often, if at all, so I think it’s very unlikely this will be an ongoing problem. Unfortunately, given the rarity and the amount of effort it would take to fix existing occurrences, I’m afraid that post will need to be recreated or left as is.

3 Likes

Okay, that makes sense. Thanks for following up. I’ll let the other users know that they can ask the staff to rebake the posts to (possibly) fix the issue, but that there will not be an automatic fix made.

2 Likes

And I guess it would be best to stop using emoji in polls?

Unfortunately it seems that the ‘rebuild HTML’ option doesn’t work:

I have since removed the polls entirely.