diff --git a/editor.planx.uk/src/components/Header.tsx b/editor.planx.uk/src/components/Header.tsx index ee2c12563f..c2a668a2e5 100644 --- a/editor.planx.uk/src/components/Header.tsx +++ b/editor.planx.uk/src/components/Header.tsx @@ -484,7 +484,6 @@ const EditorToolbar: React.FC<{ ? `All teams` : user.teams .map((team) => team.team.name) - .concat(["Templates"]) .join(", ")} diff --git a/editor.planx.uk/src/pages/FlowEditor/lib/store/user.ts b/editor.planx.uk/src/pages/FlowEditor/lib/store/user.ts index 0f8cec17fd..8ca692315c 100644 --- a/editor.planx.uk/src/pages/FlowEditor/lib/store/user.ts +++ b/editor.planx.uk/src/pages/FlowEditor/lib/store/user.ts @@ -1,4 +1,4 @@ -import { User } from "@opensystemslab/planx-core/types"; +import { User, UserTeams } from "@opensystemslab/planx-core/types"; import { _client } from "client"; import jwtDecode from "jwt-decode"; import { Team } from "types"; @@ -24,13 +24,12 @@ export const userStore: StateCreator = ( canUserEditTeam(teamSlug) { const user = this.getUser(); if (!user) return false; + + const hasTeamEditorRole = (team: UserTeams) => team.role === "teamEditor" && team.team.slug === teamSlug; return ( user.isPlatformAdmin || - teamSlug === "templates" || - user.teams.filter( - (team) => team.role === "teamEditor" && team.team.slug === teamSlug, - ).length > 0 + user.teams.some(hasTeamEditorRole) ); },