Skip to content

🛂(frontend) block edition to not connected users #945

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

AntoLC
Copy link
Collaborator

@AntoLC AntoLC commented May 6, 2025

Purpose

We can have none connected users who overwrite documents with connected users.
See: #486

Proposal

If an editor is working on a shared document but is not connected to the collaborative server
we are now blocking the edition.

We are blocking when:

  • The user is online (has internet)
  • The user is not connected to the collaboration server
  • The doc has members or is "public editable" or "auth editable"

  • 🛂(frontend) block edition to not connected users
  • ✈️(frontend) allow editing when offline
  • tests

Demo

In the demo we are not connected to the collaboration server.

scrnli_pkFb1Rn1YN1lhY.webm

@AntoLC AntoLC self-assigned this May 6, 2025
@AntoLC AntoLC added frontend SW Service worker labels May 6, 2025
@AntoLC AntoLC linked an issue May 6, 2025 that may be closed by this pull request
@AntoLC AntoLC force-pushed the feature/block-editing-collab branch 3 times, most recently from 102486c to 7892230 Compare May 7, 2025 21:51
@AntoLC AntoLC marked this pull request as ready for review May 9, 2025 10:15
AntoLC added 2 commits May 9, 2025 12:17
If an editor is working on a shared document but
is not connected to the collaborative server
we are now blocking the edition.
It is to avoid none connected users to
overwrite the document with connected
users.
When the user is offline, we allow editing the
document in the editor.
Their is not a reliable way to know if the user is
offline or online except by doing a network request
and checking if an error is thrown or not.
To do so, we created the OfflinePlugin inherited
from the WorkboxPlugin.
It will inform us if the user is offline or online.
We then dispatch the information to our application
thanks to the useOffline hook.
@AntoLC AntoLC force-pushed the feature/block-editing-collab branch from e2a9d1f to 30da3f3 Compare May 9, 2025 10:18
@AntoLC AntoLC requested review from PanchoutNathan and rvveber May 9, 2025 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend SW Service worker
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When no websockets and multi-editors switch user rights to read-only
1 participant