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

fix(ui): updatedAt field in locked-docs collection able to be updated by non-owner #9026

Merged
merged 7 commits into from
Nov 5, 2024

Conversation

PatrikKozak
Copy link
Contributor

@PatrikKozak PatrikKozak commented Nov 4, 2024

What?

If you have a custom field that sets the value of the field using the useField hook on entry into a document - the updatedAt field would be updated even when a non-owner tries to enter a locked document.

Why?

When a field is updated in the edit view - we perform an update in form-state to keep the doc in payload-locked-documents up to date with the current editing status. The above scenario would hit this update operation even on non-owner users because it was previously only checking for updateLastEdited (which would get hit by the setValue in the useField hook) so we also need to check to make sure the current user entering a locked doc is also the owner of the document.

How?

When performing an update to payload-locked-documents in buildFormState - only perform the update if the current user is also the owner of the locked document otherwise skip the update operation.

Fixes #8781

@PatrikKozak PatrikKozak changed the title fix(ui): updatedAt field in payload-locked-docs able to updated by non-owner fix(ui): updatedAt field in payload-locked-docs able to be updated by non-owner Nov 4, 2024
@PatrikKozak PatrikKozak changed the title fix(ui): updatedAt field in payload-locked-docs able to be updated by non-owner fix(ui): updatedAt field in locked-docs collection able to be updated by non-owner Nov 4, 2024
@PatrikKozak PatrikKozak merged commit ebd3c02 into beta Nov 5, 2024
52 checks passed
@PatrikKozak PatrikKozak deleted the fix/beta/useField-locked-docs branch November 5, 2024 17:39
Copy link

github-actions bot commented Nov 6, 2024

🚀 This is included in version v3.0.0-beta.125

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

Successfully merging this pull request may close these issues.

useField can incorrectly update document lock
2 participants