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
14 changes: 11 additions & 3 deletions chaoscenter/authentication/pkg/project/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,11 +365,19 @@ func (r repository) UpdateProjectState(ctx context.Context, userID string, deact
{"members", bson.D{
{"$elemMatch", bson.D{
{"user_id", userID},
{"role", bson.D{
{"$eq", entities.RoleOwner},
{"role", entities.RoleOwner},
}},
}},
Comment on lines 366 to +370
Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

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

The owner-matching $elemMatch doesn’t include invitation status. Since project visibility elsewhere treats non-accepted invitations as inactive (see chaoscenter/authentication/api/utils/project_utils.go:104-121), consider adding invitation == Accepted (and likewise in the “other owner” $elemMatch) so only accepted owners keep a project from being marked removed.

Copilot uses AI. Check for mistakes.
{"members", bson.D{
{"$not", bson.D{
{"$elemMatch", bson.D{
{"user_id", bson.D{{"$ne", userID}}},
{"role", entities.RoleOwner},
{"deactivated_at", bson.D{{"$not", bson.D{{"$gt", int64(0)}}}}},
}},
}},
}}}
}},
}

update = bson.D{
{"$set", bson.D{
Expand Down
Loading