-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
fix(next, ui): only show locked docs that are not expired #8899
Conversation
…pired-document-locks
…pired-document-locks
…pired-document-locks
…view view as well
const validLockedDocs = lockedDocs.filter((lock) => { | ||
const lastEditedAt = new Date(lock?.updatedAt).getTime() | ||
return lastEditedAt + lockDurationInMilliseconds > now | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed? It seems that we already queried for lockedDocuments with the where filter updatedAt.
There might be some more code reuse we can add when you're doing tests. Good enough for now! |
const isLockingEnabled = lockDocumentsProp !== false | ||
|
||
const lockDurationDefault = 300 // Default 5 minutes in seconds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like it should be somewhere else. Maybe set in sanitization?
🚀 This is included in version v3.0.0-beta.120 |
Issue
:Previously, documents that were locked but expired would still show in the list view / render the
DocumentLocked
modal upon other users entering the document.The expected outcome should be having expired locked documents seen as unlocked to other users.
I.e:
DocumentLocked
modal from appearing for other users - requiring a take over.Fix
:updatedAt
dates are greater than the the current time minus the lock duration.deleteMany
on expired documents when any user edits any other document in the same collection.Fixes #8778
TODO
: Add tests