fixing notification adapter

This commit is contained in:
orangecoding
2026-06-02 19:53:06 +02:00
parent 6428e7ad78
commit 34b68e1f52
2 changed files with 6 additions and 4 deletions

View File

@@ -18,7 +18,7 @@ const notificationAdapter = await Promise.all(
*/
export default async function notificationAdapterPlugin(fastify) {
fastify.get('/', async () => {
return notificationAdapter.map((adapter) => adapter.config);
return notificationAdapter.map((adapter) => adapter.config).filter(Boolean);
});
fastify.post('/try', async (request, reply) => {

View File

@@ -73,7 +73,9 @@ export default function NotificationAdapterMutator({
const adapter = useSelector((state) => state.notificationAdapter);
const preFilledSelectedAdapter =
editNotificationAdapter == null ? null : adapter.find((a) => a.id === editNotificationAdapter.id);
editNotificationAdapter == null
? null
: adapter.filter((a) => a != null).find((a) => a.id === editNotificationAdapter.id);
spreadPrefilledAdapterWithValues(preFilledSelectedAdapter, editNotificationAdapter?.fields);
@@ -227,9 +229,9 @@ export default function NotificationAdapterMutator({
className="providerMutator__fields"
value={selectedAdapter == null ? '' : selectedAdapter.id}
optionList={adapter
.filter((a) => a != null)
.map((a) => {
return {
otherKey: a.id,
value: a.id,
label: a.name,
};
@@ -238,7 +240,7 @@ export default function NotificationAdapterMutator({
.filter((option) =>
editNotificationAdapter != null
? true
: selected.find((selectedOption) => selectedOption.id === option.key) == null,
: selected.find((selectedOption) => selectedOption.id === option.value) == null,
)
.sort(sortAdapter)}
onChange={(value) => {