From af3758a521deb75b00c5f87c43c26ef113140a67 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sat, 15 Mar 2025 11:15:35 -0400 Subject: [PATCH] Move creation permission --- app/actions/definitions/documents.tsx | 2 +- app/components/TeamLogo.ts | 14 +++++++++++++- .../TemplatizeDialog/SelectLocation.tsx | 2 +- server/policies/collection.ts | 19 ++++++++++++++----- server/policies/document.test.ts | 10 ++++++++-- server/policies/document.ts | 16 +++++++++++----- server/routes/api/documents/documents.ts | 6 +++++- 7 files changed, 53 insertions(+), 16 deletions(-) diff --git a/app/actions/definitions/documents.tsx b/app/actions/definitions/documents.tsx index 165c526b03..85db5f1fe9 100644 --- a/app/actions/definitions/documents.tsx +++ b/app/actions/definitions/documents.tsx @@ -771,7 +771,7 @@ export const createTemplateFromDocument = createAction({ } return !!( !!activeCollectionId && - stores.policies.abilities(activeCollectionId).updateDocument + stores.policies.abilities(activeCollectionId).createTemplate ); }, perform: ({ activeDocumentId, stores, t, event }) => { diff --git a/app/components/TeamLogo.ts b/app/components/TeamLogo.ts index baba4b34ac..7e943f1f6c 100644 --- a/app/components/TeamLogo.ts +++ b/app/components/TeamLogo.ts @@ -4,8 +4,20 @@ import { Avatar } from "./Avatar"; const TeamLogo = styled(Avatar)` border-radius: 4px; - box-shadow: inset 0 0 0 1px ${s("divider")}; border: 0; + position: relative; + + &::before { + content: ""; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + border-radius: 4px; + box-shadow: inset 0 0 0 1px ${s("divider")}; + z-index: -1; + } `; export default TeamLogo; diff --git a/app/components/TemplatizeDialog/SelectLocation.tsx b/app/components/TemplatizeDialog/SelectLocation.tsx index 25666aa751..bb5221b450 100644 --- a/app/components/TemplatizeDialog/SelectLocation.tsx +++ b/app/components/TemplatizeDialog/SelectLocation.tsx @@ -52,7 +52,7 @@ const SelectLocation = ({ defaultCollectionId, onSelect }: Props) => { collections.orderedData.reduce((memo, collection) => { const canCollection = policies.abilities(collection.id); - if (canCollection.createDocument) { + if (canCollection.createTemplate) { memo.push({ label: (