Skip to content
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

Deny editing when someone is editing hypha now #25

Open
DanInSpace104 opened this issue Nov 5, 2020 · 1 comment
Open

Deny editing when someone is editing hypha now #25

DanInSpace104 opened this issue Nov 5, 2020 · 1 comment

Comments

@DanInSpace104
Copy link
Contributor

If two users edit the last hypha at the same time, whoever finishes - that result will be saved. This is very bad and unpredictable behavior. You can solve it like this - when the user goes to the hypha editing page - for everyone else this page is blocked with an warning like "Someone is already editing this hypha, please wait." Or, simply notify the user about such a problem without blocking the page. The hardest option is to use different branches and allow the user to resolve merge conflicts.

Если два пользователя редактируют гифу одновременно, кто закончит последний - тот результат и сохранится. Это очень плохое и непредсказуемое поведение. Решить его можно так - когда пользователь переходит на страницу редактирования гифы - всем остальным эта страница блокируется с надписью вроде "Кто-то уже редактирует эту гифу, пожалуйста, подождите." Либо просто уведомлять пользователя о такой проблеме, не блокируя страницу. Самый сложный вариант - использовать разные ветки и позволить пользователю разрешать конфликты мерджа.

@bouncepaw
Copy link
Owner

This is very bad and unpredictable behavior.

Agreed.

You can solve it like this - when the user goes to the hypha editing page - for everyone else this page is blocked with an warning like "Someone is already editing this hypha, please wait."

It's a good exploit to make whole wiki uneditable by opening the edit page for every hypha there is. Also, how do we determine that there is an edit going on? Not every visit to /edit/$hypha ends up with a successful edit. Do we impose a timeout? How long?

That's difficult.

simply notify the user about such a problem without blocking the page.

This is the closest to what I will propose later in this message.

The hardest option is to use different branches and allow the user to resolve merge conflicts.

This option is not considered because MycorrhizaWiki uses only one branch by design.

My design

A similar alcorithm is used on some wiki engines and, surprisingly, forum engines (replying to thread that had changed while you were writing your messages).

  • When an editor visits /edit/$hypha, we save latest revision's hash or timestamp. Let's say it's A.
  • When the same editor saves the edit, before that, we save latest revision's hash or timestamp. Let's say it's B.

If there was no edit done by anyone else between these two points of time (A = B), save successfully. Otherwise (A ≠ B), warn the user with something like The hypha you are trying to edit has been changed. Look at the changes:; the user is supposed to adjust their document to match the new edit.

A and B can saved in the user's cookies. Even though the user can modify the cookies, it won't break anything.

I guess this can be implemented someday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants