Skip to content

Commit

Permalink
chore: fix misleading isLead field name on Team (#9413)
Browse files Browse the repository at this point in the history
* chore: fix misleading `isLead` field name on `Team`

The field indicates whether the viewer is the lead, but when used in a
query for a different user, the result could be read wrong.

* Fix Team.isLead dependencies
  • Loading branch information
Dschoordsch authored Feb 16, 2024
1 parent a0af0c1 commit c0a2fdf
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/client/components/ReviewRequestToJoinOrgModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const ReviewRequestToJoinOrgModalViewerFragment = graphql`
teams {
id
name
isLead
isViewerLead
teamMembers(sortBy: "preferredName") {
userId
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const ManageTeamList = (props: Props) => {
const team = useFragment(
graphql`
fragment ManageTeamList_team on Team {
isLead
isViewerLead
isOrgAdmin
teamMembers(sortBy: "preferredName") {
id
Expand All @@ -36,7 +36,7 @@ const ManageTeamList = (props: Props) => {
`,
props.team
)
const {isLead: isViewerLead, isOrgAdmin: isViewerOrgAdmin, teamMembers} = team
const {isViewerLead, isOrgAdmin: isViewerOrgAdmin, teamMembers} = team
return (
<List>
{teamMembers.map((teamMember) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const query = graphql`
viewer {
team(teamId: $teamId) {
...ArchiveTeam_team
isLead
isViewerLead
id
name
tier
Expand Down
2 changes: 1 addition & 1 deletion packages/client/mutations/PromoteToTeamLeadMutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {PromoteToTeamLeadMutation as TPromoteToTeamLeadMutation} from '../__gene
graphql`
fragment PromoteToTeamLeadMutation_team on PromoteToTeamLeadPayload {
team {
isLead
isViewerLead
}
oldLeader {
...DashboardAvatar_teamMember
Expand Down
2 changes: 1 addition & 1 deletion packages/server/graphql/public/typeDefs/Team.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ type Team {
"""
true if the viewer is the team lead, else false
"""
isLead: Boolean!
isViewerLead: Boolean!

"""
true if the viewer is an admin for the team's org, else false
Expand Down
2 changes: 1 addition & 1 deletion packages/server/graphql/types/Team.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ const Team: GraphQLObjectType = new GraphQLObjectType<ITeam, GQLContext>({
return dataLoader.get('teamInvitationsByTeamId').load(teamId)
}
},
isLead: {
isViewerLead: {
type: new GraphQLNonNull(GraphQLBoolean),
description: 'true if the viewer is the team lead, else false',
resolve: async (
Expand Down

0 comments on commit c0a2fdf

Please sign in to comment.