mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Allow array of user IDs for Notify operation (#14694)
* Allow array of user IDs for Notify operation * Update app/src/operations/notification/index.ts * use csv for all tags interfaces in Flow operations
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Accountability } from '@directus/shared/types';
|
||||
import { defineOperationApi, optionToString } from '@directus/shared/utils';
|
||||
import { defineOperationApi, optionToString, toArray } from '@directus/shared/utils';
|
||||
import { NotificationsService } from '../../services';
|
||||
import { getAccountabilityForRole } from '../../utils/get-accountability-for-role';
|
||||
|
||||
@@ -36,12 +36,15 @@ export default defineOperationApi<Options>({
|
||||
|
||||
const messageString = message ? optionToString(message) : null;
|
||||
|
||||
const result = await notificationsService.createOne({
|
||||
recipient,
|
||||
sender: customAccountability?.user ?? null,
|
||||
subject,
|
||||
message: messageString,
|
||||
const payload = toArray(recipient).map((userId) => {
|
||||
return {
|
||||
recipient: userId,
|
||||
sender: customAccountability?.user ?? null,
|
||||
subject,
|
||||
message: messageString,
|
||||
};
|
||||
});
|
||||
const result = await notificationsService.createMany(payload);
|
||||
|
||||
return result;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user