diff --git a/.changeset/stale-tips-relax.md b/.changeset/stale-tips-relax.md new file mode 100644 index 0000000000..d40d74af88 --- /dev/null +++ b/.changeset/stale-tips-relax.md @@ -0,0 +1,6 @@ +--- +"@directus/app": patch +"@directus/api": patch +--- + +Added Collection and Item Options to Flows Notification Operation diff --git a/api/src/operations/notification/index.ts b/api/src/operations/notification/index.ts index c291852bcf..9bb032fbdc 100644 --- a/api/src/operations/notification/index.ts +++ b/api/src/operations/notification/index.ts @@ -8,12 +8,17 @@ type Options = { subject: string; message?: unknown | null; permissions: string; // $public, $trigger, $full, or UUID of a role + collection?: string; + item?: string; }; export default defineOperationApi({ id: 'notification', - handler: async ({ recipient, subject, message, permissions }, { accountability, database, getSchema }) => { + handler: async ( + { recipient, subject, message, permissions, collection, item }, + { accountability, database, getSchema } + ) => { const schema = await getSchema({ database }); let customAccountability: Accountability | null; @@ -34,6 +39,8 @@ export default defineOperationApi({ }); const messageString = message ? optionToString(message) : null; + const collectionString = message ? optionToString(collection) : null; + const itemString = message ? optionToString(item) : null; const payload = toArray(recipient).map((userId) => { return { @@ -41,6 +48,8 @@ export default defineOperationApi({ sender: customAccountability?.user ?? null, subject, message: messageString, + collection: collectionString, + item: itemString, }; }); diff --git a/app/src/lang/translations/en-US.yaml b/app/src/lang/translations/en-US.yaml index 85e5410927..25ac404d78 100644 --- a/app/src/lang/translations/en-US.yaml +++ b/app/src/lang/translations/en-US.yaml @@ -2189,7 +2189,9 @@ operations: recipient: User recipient_placeholder: Enter a UUID... recipient_note: Add user UUID and press enter... + item_note: Item Key or Relative URL message: Message + subject: Subject request: name: Webhook / Request URL description: 'Make a request to a URL' diff --git a/app/src/operations/notification/index.ts b/app/src/operations/notification/index.ts index db16feb661..9ce7be9aa9 100644 --- a/app/src/operations/notification/index.ts +++ b/app/src/operations/notification/index.ts @@ -61,7 +61,7 @@ export default defineOperationApp({ }, { field: 'subject', - name: '$t:title', + name: '$t:operations.notification.subject', type: 'string', meta: { width: 'full', @@ -80,5 +80,27 @@ export default defineOperationApp({ interface: 'input-rich-text-md', }, }, + { + field: 'collection', + name: '$t:collection', + type: 'string', + meta: { + width: 'half', + interface: 'system-collection', + }, + }, + { + field: 'item', + name: '$t:item', + type: 'string', + meta: { + width: 'half', + interface: 'input', + options: { + iconRight: 'vpn_key', + }, + note: '$t:operations.notification.item_note', + }, + }, ], });