statamic / collaboration

Real-time, multi-user editing with Statamic via websockets
https://statamic.com/addons/statamic/collaboration
33 stars 13 forks source link

Bard/Replicator: lock sets when locking a Bard or Replicator field #11

Closed sauerbraten closed 6 months ago

sauerbraten commented 5 years ago

When a user focuses in a Bard field, not only should the Bard field be locked but also all fields inside all sets in that Bard field. Same thing for Replicator.

helloiamlukas commented 3 years ago

Any updates on this? @jackmcdade @jesseleite @jasonvarga

This is a pretty critical bug, since users content will be overwritten.

Example:

  1. You have an Bard field. Within this field you have a set that includes another text input.
  2. A is editing text in the Bard field.
  3. B can't edit the text in the top level of the Bard field (since it is locked), but B can still edit the text input of the set.
  4. A is saving the content now and is overwriting the text input of B.

As far as I can see, the problem is that https://github.com/statamic/collaboration/blob/907ba336e4cd9f39868458a9110b4e9707f0993c/resources/js/Workspace.js#L209 is not working correctly. This will only lock the top level of the field, but doesn't work with nested inputs (e.g. Sets).

So maybe this issue belongs to the statamic/cms repo?

sauerbraten commented 3 years ago

I just opened a PR which adds set-level lock/unlock behavior to Replicator, but that does not really address Bard, at least not in collaboration: https://github.com/statamic/collaboration/pull/52

You can however look at the changes I made to Bard in the patch I linked to in that PR, those should at least fix set locking when someone is in Bard: https://github.com/sauerbraten/cms/blob/polygon-develop/TLP-1633.patch

helloiamlukas commented 3 years ago

Good timing 👀

Thanks for the patch! This should fix the Bard locking problem indeed. Did you already open a pull request to merge this into the statamic/cms repo?

Set-level lock/unlock behaviour in Replicator is a really helpful feature! Thank you for your work. It would be nice to have this for Bard too, even though for now I'm happy if at least the locking would work :)

sauerbraten commented 3 years ago

Not yet, but it's coming. We have several things we'll let Statamic have a look at for the core product; this is one of them! 👍

helloiamlukas commented 3 years ago

Great! Looking forward.

duncanmcclean commented 6 months ago

Hey 👋

I'm unable to reproduce this issue on the latest version of Statamic. Fields inside Bard & Replicator sets become read-only, as expected, when the field is locked.

Here's an example with a Bard field:

CleanShot 2024-03-20 at 10 22 15

I'm going to close this issue now. If you're still experiencing this issue, please leave a comment and we can re-open the issue. Thanks!