Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/api/plane/app/views/workspace/user_preference.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def patch(self, request, slug):
if not key:
continue

preference = WorkspaceUserPreference.objects.filter(key=key, workspace__slug=slug).first()
preference = WorkspaceUserPreference.objects.filter(key=key, workspace__slug=slug, user=request.user).first()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix. Could you, please, add a regression test for the cross-user case?

The nuance: Before this change, two users in the same workspace with the same preference key could hit filter(key=key, workspace__slug=slug).first(), so PATCH might update another user’s preference row.

For this case will be helpful a test where user A and user B both have key="views" preferences, then user B patches sort_order or is_pinned, would lock in that only user B’s row changes.


if not preference:
continue
Expand Down
Loading