-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simultaneous edits to an issue/PR lead to data loss #22907
Comments
The only solution I can see is to completely refactor the issue edit feature to use AJAX, then various problems could be resolved and it's more friendly to users if something wrong happens. |
That would be a good idea (to use the API for more aspects of the web interface), but it is far from the only solution. A simple solution would be to:
This doesn't require a big refactor of the edit feature, and does provide an initial step to protect against this hidden data loss. |
That's the hardest (nearly impossible at the moment) part without AJAX (in my opinion). That's why I proposed AJAX 😂 |
Hmmm then it looks like an inconvenient decision was made when designing the form -- either do it in JS all the way, or do it the traditional HTTP/HTML way. Sitting somewhere in the middle of those two is troublesome indeed. In any case, I think this is a high priority issue, as the safety of data in issue descriptions is kind of central to Gitea. If this can't be solved quickly, maybe some pre-flight request made with JS before the POST happens can be added on short notice? A quick OPTIONS request that can be handled to check for collissions is not perfect, but at least it narrows the window of undetected losses to a few seconds (the time between the OPTIONS and the POST request). |
We can have a version column for the issue table, so only one could update that column, and another will fail, but the form content will be kept on his web browser. |
fixes #22907 Tested: - [x] issue content edit - [x] issue content change tasklist - [x] pull request content edit - [x] pull request change tasklist ![issue-content-edit](https://github.com/go-gitea/gitea/assets/29250154/a0828889-fb96-4bc4-8600-da92e3205812)
Thanks for addressing this :) |
Description
TL;DR: When two people edit an issue/PR description simultaneously, the last one to save "wins".
This scenario is not uncommon:
This problem is quite serious, because:
So not only is there data loss, it remains undetected until someone revisits the page and actually notices their work is gone.
A possible first step could be to use an etag to detect simultaneous edits. Then at least a user can be warned that they'll overwrite someone else's changes.
It would be better to have some way to merge those changes, but that's a whole different issue to solve. I think the most important is to prevent these losses; how to solve such collisions gracefully can be dealt with later.
Gitea Version
00b18ab
Can you reproduce the bug on the Gitea demo site?
Yes
Log Gist
No response
Screenshots
No response
Git Version
No response
Operating System
No response
How are you running Gitea?
Self-built from Git.
Database
PostgreSQL
The text was updated successfully, but these errors were encountered: