Skip to content

Commit

Permalink
Use a different GraphQL field for the list of workspaces. (#2055)
Browse files Browse the repository at this point in the history
This new field returns `TeamType` objects and different behaviors for super-admins and non-super-admins.

References: CV2-4938 and CV2-4704.
  • Loading branch information
caiosba authored Aug 14, 2024
1 parent 39ea649 commit 0cf0d20
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions src/app/components/user/UserWorkspaces/PaginatedUserWorkspaces.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,28 +218,26 @@ const PaginatedUserWorkspaces = createPaginationContainer(
props => (
<UserWorkspacesComponent
currentTeam={props.root.current_team_id}
numberOfTeams={props.root.team_users_count}
numberOfTeams={props.root.accessible_teams_count}
pageSize={props.pageSize}
relay={props.relay}
teams={props.root.team_users.edges.map(n => n.node.team) || []}
totalCount={props.root.team_users?.totalCount}
teams={props.root.accessible_teams.edges.map(edge => edge.node) || []}
totalCount={props.root.accessible_teams?.totalCount}
/>
),
{
root: graphql`
fragment PaginatedUserWorkspaces_root on Me {
current_team_id
team_users_count(status: "member")
team_users(first: $pageSize, after: $after, status: "member") @connection(key: "PaginatedUserWorkspaces_team_users"){
accessible_teams_count
accessible_teams(first: $pageSize, after: $after) @connection(key: "PaginatedUserWorkspaces_accessible_teams") {
edges {
node {
team {
dbid
name
avatar
slug
members_count
}
dbid
name
avatar
slug
members_count
}
}
pageInfo {
Expand All @@ -254,7 +252,7 @@ const PaginatedUserWorkspaces = createPaginationContainer(
{
direction: 'forward',
query: userWorkspacesQuery,
getConnectionFromProps: props => props.root.team_users,
getConnectionFromProps: props => props.root.accessible_teams,
getFragmentVariables: (previousVars, pageSize) => ({
...previousVars,
pageSize,
Expand Down

0 comments on commit 0cf0d20

Please sign in to comment.