Skip to content

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

Merged
aslilac merged 17 commits into
mainfrom
user-groups-with-org-display-name
Aug 29, 2024
Merged

aslilac merged 17 commits into
mainfrom
user-groups-with-org-display-name

Conversation

@aslilac

@aslilac aslilac commented Aug 26, 2024 •

Copy link
Copy Markdown
Member

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

@Emyrk Emyrk left a comment •

Copy link
Copy Markdown
Member

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.

Comment thread coderd/database/queries/groups.sql Resolved
@aslilac

aslilac commented Aug 27, 2024

Copy link
Copy Markdown
Member Author

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

aslilac commented Aug 27, 2024

Copy link
Copy Markdown
Member Author

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
Comment thread coderd/database/queries/groups.sql Resolved
Comment thread coderd/database/queries/groups.sql Resolved
Comment thread coderd/database/queries/groups.sql Resolved
Comment thread enterprise/coderd/groups.go Resolved
Comment thread site/src/api/api.ts Resolved
@aslilac
aslilac requested a review from Emyrk August 28, 2024 18:33
@aslilac
aslilac merged commit 49afab1 into main Aug 29, 2024
@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

Development

Successfully merging this pull request may close these issues.

Account settings page currently lists the current groups a user is in. Should either replace, or include which organizations

2 participants