Skip to content

Commit

Permalink
fix: Update organization on accept invite (#9281)
Browse files Browse the repository at this point in the history
* fix: Prompt to join org without organization feature flags

When no organization feature flag was present, we would not show the
prompt to join org notification.

* fix: Update organization on accept invite

When accepting an invite in a different tab, or if the team lead accepts
a prompt to join org invite, the new organization was added partially to
the viewers organization causing undefined errors.
  • Loading branch information
Dschoordsch committed Dec 18, 2023
1 parent e581bc8 commit 9c3f372
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
18 changes: 9 additions & 9 deletions packages/client/mutations/AcceptTeamInvitationMutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ graphql`
}
team {
name
organization {
id
name
}
...DashNavListTeam
}
}
`
Expand All @@ -55,6 +50,13 @@ graphql`
activeMeetings {
id
}
organization {
id
name
...DashNavList_organization
}
...DashNavListTeam
...PublicTeamsFrag_team
}
meeting {
id
Expand Down Expand Up @@ -109,6 +111,8 @@ export const acceptTeamInvitationNotificationUpdater: SharedUpdater<
> = (payload, {store}) => {
const team = payload.getLinkedRecord('team')
if (!team) return
const organization = team.getLinkedRecord('organization')
handleAddOrganization(organization, store)
handleAddTeams(team, store)

const viewer = store.getRoot().getLinkedRecord('viewer')
Expand Down Expand Up @@ -136,10 +140,6 @@ export const acceptTeamInvitationTeamUpdater: SharedUpdater<
> = (payload, {store}) => {
const teamMember = payload.getLinkedRecord('teamMember')
handleAddTeamMembers(teamMember, store)
const team = payload.getLinkedRecord('team')
const organization = team.getLinkedRecord('organization')
handleAddOrganization(organization, store)
handleAddTeams(team, store)
}

export const acceptTeamInvitationTeamOnNext: OnNextHandler<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,13 @@ const acceptRequestToJoinDomain: MutationResolvers['acceptRequestToJoinDomain']
publish(SubscriptionChannel.TEAM, teamId, 'AcceptTeamInvitationPayload', data, subOptions)

// Send individualized message to the user
publish(SubscriptionChannel.TEAM, userId, 'AcceptTeamInvitationPayload', data, subOptions)
publish(
SubscriptionChannel.NOTIFICATION,
userId,
'AcceptTeamInvitationPayload',
data,
subOptions
)
})

return {viewerId}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,13 @@ const acceptTeamInvitation: MutationResolvers['acceptTeamInvitation'] = async (
publish(SubscriptionChannel.TEAM, teamId, 'AcceptTeamInvitationPayload', data, subOptions)

// Send individualized message to the user
publish(SubscriptionChannel.TEAM, viewerId, 'AcceptTeamInvitationPayload', data, subOptions)
publish(
SubscriptionChannel.NOTIFICATION,
viewerId,
'AcceptTeamInvitationPayload',
data,
subOptions
)

// Give the team lead new suggested actions
if (teamLeadUserIdWithNewActions) {
Expand Down

0 comments on commit 9c3f372

Please sign in to comment.