Flag comments lose text after submission when input exceeds 5000 characters

Please fill out the following sections to the best of your ability, it will help us investigate bugs if we have this information at the outset. Screenshots are especially helpful, so please provide those if you can.

Platform (Android, iOS, Website): Website

App version number, if a mobile app issue (shown under Settings): Not applicable

Browser, if a website issue (Firefox, Chrome, etc) : Chrome

URLs (aka web addresses) of any relevant observations or pages: e.g. https://www.inaturalist.org/flags/496887

Screenshots of what you are seeing (instructions for taking a screenshot on computers and mobile devices: https://www.take-a-screenshot.org/): Not applicable

Description of problem (please provide a set of steps we can use to replicate the issue, and make as many as you need.):

Step 1: Write a long reply, exceeding 5000 characters, on a “Flag”

Step 2: Press submit.

Step 3: The page refreshes & The text of the reply is lost.

That’s the essence of the problem. The form should retain the submission text instead of deleting it when one clicks “Submit”. I was lucky enough to have composted most of it in a text editor, but it results in user input being lost.

Perhaps that’s how it’s supposed to work, but in my mind that’s a “bug”.

1 Like

There is a feature request to address this:
https://forum.inaturalist.org/t/allow-comments-exceeding-5000-characters-to-be-edited-rather-than-get-immediately-deleted/10422

3 Likes

Thank you for pointing me to that. Surprised that the issue’s been sitting around since February, but c’est la vie. Cheers.

My understanding is that this was fixed for comments on observations, but remains an issue on flags, journal posts, taxon changes, listed taxa, and other parts of the site which are built on older code.

Once you’ve reached 5000 characters on observation comments, it now restricts you from typing more:
image

4 Likes

Well, that’s unfortunate. I can definitely imagine that a journal post (especially one being used as a guide) might need to be a bit more wordy than 5000 characters.

1 Like

The limit is on comments on journal posts, not journal posts themselves.

3 Likes

Thank you for clearing that up!

1 Like

Unfortunately this is currently wrong.
The journal editing form is not allow to enter more than 5000 symbols. But this is strange, because if I manually remove the maxlength=‘5000’ attribute from the area I’m able to add more symbols and they are saved without any problem. And it is possible to have a long post in journal. especially if the author uses HTML markup.

PS: I’ve looked to the problem commit.
There are checks for length of body of comment and length of title (and only title) of journal posts. But in app/views/posts/_post_form.html.haml the maxlength attribute is set for :body, not for :title. It seems to be a bug.

@kueda, could you look to this?

1 Like

Limit on journal post size was a mistake in my interpretation of what we wanted, so I’ll remove that (plus the bug @kildor noted). Limit on the size of comments has been effect for a long time and won’t change. Preventing people from exceeding the comment size limit before trying to submit the comment on non-React pages like comments on journal posts and flags is a recent change and will remain.

2 Likes