Skip to content

Commit 4ea346c

Browse files
authored
chore: Normalize TeamMember (#11026)
1 parent 177b607 commit 4ea346c

File tree

76 files changed

+366
-314
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+366
-314
lines changed

packages/client/components/ActionMeetingAgendaItems.tsx

+6-3
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ const ActionMeetingAgendaItems = (props: Props) => {
8282
// optimistic updater could remove the agenda item
8383
if (!agendaItem) return null
8484
const {content, teamMember} = agendaItem
85-
const {picture, preferredName} = teamMember
85+
const {user} = teamMember
86+
const {picture, preferredName} = user
8687
const allowedThreadables: DiscussionThreadables[] = endedAt ? [] : ['comment', 'task', 'poll']
8788
return (
8889
<MeetingContent ref={meetingContentRef}>
@@ -130,8 +131,10 @@ graphql`
130131
agendaItem {
131132
content
132133
teamMember {
133-
picture
134-
preferredName
134+
user {
135+
picture
136+
preferredName
137+
}
135138
}
136139
}
137140
}

packages/client/components/ActionMeetingFirstCall.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ const ActionMeetingFirstCall = (props: Props) => {
3737
endedAt
3838
facilitatorUserId
3939
facilitator {
40-
preferredName
40+
user {
41+
preferredName
42+
}
4143
}
4244
phases {
4345
phaseType
@@ -52,7 +54,7 @@ const ActionMeetingFirstCall = (props: Props) => {
5254
const atmosphere = useAtmosphere()
5355
const {viewerId} = atmosphere
5456
const {endedAt, facilitator, facilitatorUserId, phases, showSidebar} = meeting
55-
const {preferredName} = facilitator
57+
const {preferredName} = facilitator.user
5658
const isFacilitating = facilitatorUserId === viewerId && !endedAt
5759
const phaseName = phaseLabelLookup[AGENDA_ITEMS]
5860
const agendaItemPhase = phases.find((phase) => phase.phaseType === 'agendaitems')!

packages/client/components/ActionMeetingLastCall.tsx

+6-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ const ActionMeetingLastCall = (props: Props) => {
4444
id
4545
facilitatorUserId
4646
facilitator {
47-
preferredName
47+
user {
48+
preferredName
49+
}
4850
}
4951
phases {
5052
phaseType
@@ -65,7 +67,9 @@ const ActionMeetingLastCall = (props: Props) => {
6567
const {stages} = agendaItemPhase ?? {}
6668
if (!stages) return null
6769
const agendaItemsCompleted = stages.filter((stage) => stage.isComplete).length
68-
const {preferredName} = facilitator
70+
const {
71+
user: {preferredName}
72+
} = facilitator
6973
const isFacilitating = facilitatorUserId === viewerId && !endedAt
7074
const labelAgendaItems = plural(0, AGENDA_ITEM_LABEL)
7175
const endMeeting = () => {

packages/client/components/ActionMeetingUpdatesPrompt.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ const ActionMeetingUpdatesPrompt = (props: Props) => {
5757
meetingMembers {
5858
...ActionMeetingUpdatesPromptTeamHelpText_currentMeetingMember
5959
user {
60+
picture
61+
preferredName
6062
isConnected
6163
}
6264
teamMember {
6365
id
6466
isSelf
65-
picture
66-
preferredName
6767
}
6868
}
6969
phases {
@@ -85,8 +85,8 @@ const ActionMeetingUpdatesPrompt = (props: Props) => {
8585
)
8686
if (!currentMeetingMember) return null
8787
const {teamMember, user} = currentMeetingMember
88-
const {isSelf: isViewerMeetingSection, picture, preferredName} = teamMember
89-
const {isConnected} = user
88+
const {isSelf: isViewerMeetingSection} = teamMember
89+
const {picture, preferredName, isConnected} = user
9090
const prefix = isConnected ? `${preferredName}, ` : ''
9191
const taskCount = tasks.edges.length
9292
return (

packages/client/components/AddTeamMemberModal.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,10 @@ const AddTeamMemberModal = (props: Props) => {
128128
const teamMembers = useFragment(
129129
graphql`
130130
fragment AddTeamMemberModal_teamMembers on TeamMember @relay(plural: true) {
131-
email
131+
user {
132+
id
133+
email
134+
}
132135
}
133136
`,
134137
teamMembersRef
@@ -148,7 +151,7 @@ const AddTeamMemberModal = (props: Props) => {
148151
const allInvitees = parsedInvitees
149152
? (parsedInvitees.map((invitee: any) => invitee.address) as string[])
150153
: []
151-
const teamEmailSet = new Set(teamMembers.map(({email}) => email))
154+
const teamEmailSet = new Set(teamMembers.map(({user}) => user.email))
152155
const uniqueInvitees = Array.from(new Set(allInvitees))
153156
if (invalidEmailExists) {
154157
const lastValidEmail = uniqueInvitees[uniqueInvitees.length - 1]

packages/client/components/DashboardAvatars/DashboardAvatar.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,22 @@ const DashboardAvatar = (props: Props) => {
2828
...PromoteTeamMemberModal_teamMember
2929
...RemoveTeamMemberModal_teamMember
3030
id
31-
picture
3231
teamId
33-
preferredName
3432
user {
33+
picture
34+
preferredName
3535
isConnected
3636
}
3737
}
3838
`,
3939
teamMemberRef
4040
)
41-
const {id: teamMemberId, picture, teamId, preferredName} = teamMember
41+
const {id: teamMemberId, teamId} = teamMember
4242
const {user} = teamMember
4343
if (!user) {
4444
throw new Error(`User Avatar unavailable. ${JSON.stringify(teamMember)}`)
4545
}
46-
const {isConnected} = user
46+
const {isConnected, preferredName, picture} = user
4747
const atmosphere = useAtmosphere()
4848
const {submitting, onError, onCompleted, submitMutation} = useMutationProps()
4949
const {tooltipPortal, openTooltip, closeTooltip, originRef} = useTooltip<HTMLDivElement>(

packages/client/components/DashboardAvatars/DashboardAvatars.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ const DashboardAvatars = (props: Props) => {
8686
...AddTeamMemberAvatarButton_teamMembers
8787
...DashboardAvatar_teamMember
8888
id
89-
preferredName
9089
user {
9190
isConnected
9291
}

packages/client/components/DashboardAvatars/TeamMemberAvatarMenu.tsx

+6-3
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,18 @@ const TeamMemberAvatarMenu = (props: Props) => {
3838
graphql`
3939
fragment TeamMemberAvatarMenu_teamMember on TeamMember {
4040
isSelf
41-
preferredName
42-
userId
41+
user {
42+
id
43+
preferredName
44+
}
4345
isLead
4446
}
4547
`,
4648
teamMemberRef
4749
)
4850
const atmosphere = useAtmosphere()
49-
const {preferredName, userId} = teamMember
51+
const {user} = teamMember
52+
const {id: userId, preferredName} = user
5053
const {viewerId} = atmosphere
5154
const isSelf = userId === viewerId
5255
const isViewerTeamAdmin = isViewerLead || isViewerOrgAdmin

packages/client/components/Facilitator.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ const Facilitator = (props: Props) => {
112112
}
113113
}
114114
facilitator {
115-
picture
116-
preferredName
117115
user {
116+
picture
117+
preferredName
118118
isConnected
119119
}
120120
}
@@ -126,9 +126,9 @@ const Facilitator = (props: Props) => {
126126
const connectedMemberIds = meetingMembers
127127
.filter(({user}) => user.isConnected)
128128
.map(({user}) => user.id)
129-
const {user, picture, preferredName} = facilitator
129+
const {user} = facilitator
130130
// https://sentry.io/share/issue/efef01c3e7934ab981ed5c80ef2d64c8/
131-
const isConnected = user?.isConnected ?? false
131+
const {picture = '', preferredName = '', isConnected = false} = user ?? {}
132132
const {togglePortal, menuProps, menuPortal, originRef, portalStatus} = useMenu<HTMLDivElement>(
133133
MenuPosition.UPPER_RIGHT,
134134
{

packages/client/components/MeetingSidebarTeamMemberStageItems.tsx

+6-3
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ const MeetingSidebarTeamMemberStageItems = (props: Props) => {
8686
if (!teamMember || !teamMemberId) {
8787
return null
8888
}
89-
const {picture, preferredName} = teamMember
89+
const {user} = teamMember
90+
const {picture, preferredName} = user
9091
const isLocalStage = localStageId === stageId
9192
const isFacilitatorStage = facilitatorStageId === stageId
9293
const isUnsyncedFacilitatorStage = isFacilitatorStage !== isLocalStage && !isLocalStage
@@ -127,8 +128,10 @@ graphql`
127128
... on NewMeetingTeamMemberStage {
128129
teamMemberId
129130
teamMember {
130-
picture
131-
preferredName
131+
user {
132+
picture
133+
preferredName
134+
}
132135
}
133136
}
134137
}

packages/client/components/NewMeetingCheckIn.tsx

+7-5
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ const NewMeetingCheckIn = (props: Props) => {
7070
const {endedAt, showSidebar, localStage, phases} = meeting
7171
const {id: localStageId} = localStage
7272
const teamMember = localStage.teamMember!
73-
const {userId} = teamMember
73+
const {user} = teamMember
7474
const nextStageRes = findStageAfterId(phases, localStageId)
7575
// in case the checkin is the last phase of the meeting
7676
if (!nextStageRes) return null
7777
const {viewerId} = atmosphere
78-
const isViewerMeetingSection = userId === viewerId
78+
const isViewerMeetingSection = user.id === viewerId
7979
return (
8080
<MeetingContent>
8181
<MeetingHeaderAndPhase hideBottomBar={!!endedAt}>
@@ -87,7 +87,7 @@ const NewMeetingCheckIn = (props: Props) => {
8787
<PhaseHeaderTitle>{phaseLabelLookup.checkin}</PhaseHeaderTitle>
8888
</MeetingTopBar>
8989
<PhaseWrapper>
90-
<NewMeetingCheckInPrompt meeting={meeting} teamMember={teamMember} />
90+
<NewMeetingCheckInPrompt meetingRef={meeting} userRef={user} />
9191
<CheckIn>
9292
{isViewerMeetingSection && (
9393
<Hint>
@@ -107,8 +107,10 @@ const NewMeetingCheckIn = (props: Props) => {
107107
graphql`
108108
fragment NewMeetingCheckInLocalStage on CheckInStage {
109109
teamMember {
110-
userId
111-
...NewMeetingCheckInPrompt_teamMember
110+
user {
111+
id
112+
...NewMeetingCheckInPrompt_user
113+
}
112114
}
113115
}
114116
`

packages/client/components/NewMeetingTeamPickerAvatars.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ const NewMeetingTeamPickerAvatars = (props: Props) => {
3333
fragment NewMeetingTeamPickerAvatars_team on Team {
3434
teamMembers {
3535
id
36-
picture
36+
user {
37+
picture
38+
}
3739
isLead
3840
isSelf
3941
}
@@ -63,7 +65,8 @@ const NewMeetingTeamPickerAvatars = (props: Props) => {
6365
return (
6466
<Container count={randomAvatars.length}>
6567
{randomAvatars.map((teamMember) => {
66-
const {picture} = teamMember
68+
const {user} = teamMember
69+
const {picture} = user
6770
return (
6871
<ErrorBoundary key={`pickerAvatar${teamMember.id}`}>
6972
<AvatarWrapper count={randomAvatars.length}>

packages/client/components/TaskFooterIntegrateMenu.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ const query = graphql`
2323
viewer {
2424
id
2525
assigneeTeamMember: teamMember(userId: $userId, teamId: $teamId) {
26-
preferredName
26+
user {
27+
preferredName
28+
}
2729
prevUsedRepoIntegrations(first: 1) {
2830
items {
2931
id
@@ -65,7 +67,8 @@ const TaskFooterIntegrateMenu = (props: Props) => {
6567
const isAssigneeIntegrated = useIsIntegrated(assigneeTeamMember?.integrations)
6668
if (!assigneeTeamMember || !viewerTeamMember) return null
6769
const {integrations: viewerIntegrations} = viewerTeamMember
68-
const {preferredName: assigneeName, prevUsedRepoIntegrations} = assigneeTeamMember
70+
const {user: assigneeUser, prevUsedRepoIntegrations} = assigneeTeamMember
71+
const {preferredName: assigneeName} = assigneeUser
6972
const {teamId, userId, id: taskId} = task
7073
const isViewerAssignee = viewerId === userId
7174
const showAssigneeIntegrations = !!(

packages/client/components/TaskInvolves.tsx

+6-3
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,10 @@ const TaskInvolves = (props: Props) => {
7575
...NotificationTemplate_notification
7676
id
7777
changeAuthor {
78-
picture
79-
preferredName
78+
user {
79+
picture
80+
preferredName
81+
}
8082
}
8183
involvement
8284
status
@@ -100,7 +102,8 @@ const TaskInvolves = (props: Props) => {
100102
)
101103
const {id: notificationId, task, team, involvement, changeAuthor} = notification
102104
const {content, status, tags, user} = task || deletedTask
103-
const {picture: changeAuthorPicture, preferredName: changeAuthorName} = changeAuthor
105+
const {user: changeAuthorUser} = changeAuthor
106+
const {picture: changeAuthorPicture, preferredName: changeAuthorName} = changeAuthorUser
104107
const {name: teamName, id: teamId} = team
105108
const action = involvementWord[involvement]
106109
const {submitMutation, onCompleted, onError, submitting} = useMutationProps()

packages/client/components/TeamDashTeamMemberMenu.tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ const TeamDashTeamMemberMenu = (props: Props) => {
2828
}
2929
teamMembers(sortBy: "preferredName") {
3030
id
31-
preferredName
31+
user {
32+
preferredName
33+
}
3234
}
3335
}
3436
`,
@@ -43,7 +45,7 @@ const TeamDashTeamMemberMenu = (props: Props) => {
4345
query,
4446
filteredItems: matchedTeamMembers,
4547
onQueryChange
46-
} = useSearchFilter(teamMembers, (teamMember) => teamMember.preferredName)
48+
} = useSearchFilter(teamMembers, ({user}) => user.preferredName)
4749

4850
return (
4951
<Menu
@@ -71,7 +73,7 @@ const TeamDashTeamMemberMenu = (props: Props) => {
7173
{matchedTeamMembers.map((teamMember) => (
7274
<MenuItem
7375
key={`teamMemberFilter${teamMember.id}`}
74-
label={teamMember.preferredName}
76+
label={teamMember.user.preferredName}
7577
onClick={() => filterTeamMember(atmosphere, teamId, teamMember.id)}
7678
/>
7779
))}

packages/client/components/TeamFilterMenu.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ const TeamFilterMenu = (props: Props) => {
3535
name
3636
teamMembers(sortBy: "preferredName") {
3737
userId
38-
preferredName
3938
}
4039
}
4140
}

packages/client/components/TeamPrompt/TeamPromptDiscussionDrawer.tsx

+8-4
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,10 @@ const TeamPromptDiscussionDrawer = ({meetingRef, onToggleDrawer}: Props) => {
8989
... on TeamPromptResponseStage {
9090
discussionId
9191
teamMember {
92-
picture
93-
preferredName
92+
user {
93+
picture
94+
preferredName
95+
}
9496
}
9597
response {
9698
id
@@ -128,6 +130,8 @@ const TeamPromptDiscussionDrawer = ({meetingRef, onToggleDrawer}: Props) => {
128130
if (!discussionId || !teamMember) {
129131
return null
130132
}
133+
const {user} = teamMember
134+
const {picture, preferredName} = user
131135

132136
const onToggleReactji = (emojiId: string) => {
133137
if (submitting || !reactjis || !response) return
@@ -156,9 +160,9 @@ const TeamPromptDiscussionDrawer = ({meetingRef, onToggleDrawer}: Props) => {
156160
<DiscussionResponseCard>
157161
<Header>
158162
<div className='flex items-center'>
159-
<Avatar picture={teamMember.picture} className={'h-12 w-12'} />
163+
<Avatar picture={picture} className={'h-12 w-12'} />
160164
<TeamMemberName>
161-
{teamMember.preferredName}
165+
{preferredName}
162166
{response && (
163167
<TeamPromptLastUpdatedTime
164168
updatedAt={response.updatedAt}

0 commit comments

Comments
 (0)