Skip to content

[bug]: Sidebar pin/unpin not persisted — WorkspaceUserPreference PATCH missing user filter #9260

@tubaAdgzl

Description

@tubaAdgzl

Current behavior

Sidebar pin/unpin changes return 200 OK but are not saved for the requesting user. After page refresh, pins revert to previous state.

Root cause

In plane/app/views/workspace/user_preference.py, the patch method filters preferences without scoping to request.user:

# v1.3.1 — missing user filter
preference = WorkspaceUserPreference.objects.filter(
    key=key, workspace__slug=slug
).first()

In a workspace with multiple members, this returns the first matching record regardless of user — so the wrong user's preference gets updated.

Fix

Add user=request.user to the filter:

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

Steps to reproduce

  1. Self-host Plane v1.3.1 with Docker
  2. Create a workspace with 2+ members
  3. Log in as any user
  4. Pin a sidebar item (e.g. Analytics, Archives)
  5. Refresh the page → pin reverts

Verified

  • DB shows is_pinned: False after PATCH despite 200 OK response
  • Adding user=request.user to the filter fixes the issue permanently

Version

v1.3.1 (self-hosted Docker)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions