Skip to content

feat: show organization name for groups on user profile #14448

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

Merged
merged 17 commits into from
Aug 29, 2024

Conversation

aslilac
Copy link
Member

@aslilac aslilac commented Aug 26, 2024

Closes #14213

Show the organization the group is from on the user profile page for multi-org deployments

@aslilac aslilac requested a review from Emyrk August 26, 2024 22:47
Copy link
Member

@Emyrk Emyrk left a comment

Choose a reason for hiding this comment

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

Use sqlc.embed, and another idea is to rope GetGroupByID and GetGroupsByOrgAndName into the GetGroups query.

It feels weird, but it guarantees 1 fetch query on the backend, and therefore 1 group type.

I did this with OrganizationMembers and use a wrapper func to convert the :Many to :One query:

organizationMember, err := database.ExpectOne(db.OrganizationMembers(ctx, database.OrganizationMembersParams{
OrganizationID: organization.ID,
UserID: user.ID,
}))

The alternative is making a view, but those are kinda a pain to maintain with migrations. I'll let you make that call based on where the types are used. It is just annoying to have database.GetGroupRow and database.Group types in the BE sometimes.

@aslilac
Copy link
Member Author

aslilac commented Aug 27, 2024

another idea is to rope GetGroupByID and GetGroupsByOrgAndName into the GetGroups query.

I am not against this, but it sounds like it might be a little out of my comfort zone, and probably big enough for a PR of its own

@aslilac
Copy link
Member Author

aslilac commented Aug 27, 2024

It is just annoying to have database.GetGroupRow and database.Group types in the BE sometimes.

Definitely agree. This is one of the reasons row-typing can be really nice on the backend, but we're not replacing Go anytime soon. :p

@aslilac aslilac marked this pull request as ready for review August 28, 2024 16:44
@aslilac aslilac requested a review from Emyrk August 28, 2024 16:44
@aslilac aslilac requested a review from Emyrk August 28, 2024 18:33
@aslilac aslilac merged commit 49afab1 into main Aug 29, 2024
31 checks passed
@aslilac aslilac deleted the user-groups-with-org-display-name branch August 29, 2024 16:55
@github-actions github-actions bot locked and limited conversation to collaborators Aug 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants