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

[WEB - 1518] fix: cache invalidation on new members invite #4699

Merged
merged 1 commit into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
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
11 changes: 11 additions & 0 deletions apiserver/plane/authentication/utils/workspace_project_join.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
WorkspaceMember,
WorkspaceMemberInvite,
)
from plane.utils.cache import invalidate_cache_directly


def process_workspace_project_invitations(user):
Expand All @@ -26,6 +27,16 @@
ignore_conflicts=True,
)

[

Check warning on line 30 in apiserver/plane/authentication/utils/workspace_project_join.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

apiserver/plane/authentication/utils/workspace_project_join.py#L30

Expression "[invalidate_cache_directly(path=f'/api/workspaces/{str(workspace_member_invite.workspace.slug)}/members/', url_params=False, user=False, multiple=True) for workspace_member_invite in workspace_member_invites]" is assigned to nothing
invalidate_cache_directly(
path=f"/api/workspaces/{str(workspace_member_invite.workspace.slug)}/members/",
url_params=False,
user=False,
multiple=True,
)
for workspace_member_invite in workspace_member_invites
]

# Check if user has any project invites
project_member_invites = ProjectMemberInvite.objects.filter(
email=user.email, accepted=True
Expand Down
2 changes: 1 addition & 1 deletion apiserver/plane/utils/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def invalidate_cache_directly(
custom_path = path if path is not None else request.get_full_path()
auth_header = (
None
if request.user.is_anonymous
if request and request.user.is_anonymous
else str(request.user.id) if user else None
)
key = generate_cache_key(custom_path, auth_header)
Expand Down
Loading