mirror of
https://github.com/orangecoding/fredy.git
synced 2026-06-16 12:31:07 +00:00
fixing notification adapter
This commit is contained in:
@@ -18,7 +18,7 @@ const notificationAdapter = await Promise.all(
|
|||||||
*/
|
*/
|
||||||
export default async function notificationAdapterPlugin(fastify) {
|
export default async function notificationAdapterPlugin(fastify) {
|
||||||
fastify.get('/', async () => {
|
fastify.get('/', async () => {
|
||||||
return notificationAdapter.map((adapter) => adapter.config);
|
return notificationAdapter.map((adapter) => adapter.config).filter(Boolean);
|
||||||
});
|
});
|
||||||
|
|
||||||
fastify.post('/try', async (request, reply) => {
|
fastify.post('/try', async (request, reply) => {
|
||||||
|
|||||||
@@ -73,7 +73,9 @@ export default function NotificationAdapterMutator({
|
|||||||
const adapter = useSelector((state) => state.notificationAdapter);
|
const adapter = useSelector((state) => state.notificationAdapter);
|
||||||
|
|
||||||
const preFilledSelectedAdapter =
|
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);
|
spreadPrefilledAdapterWithValues(preFilledSelectedAdapter, editNotificationAdapter?.fields);
|
||||||
|
|
||||||
@@ -227,9 +229,9 @@ export default function NotificationAdapterMutator({
|
|||||||
className="providerMutator__fields"
|
className="providerMutator__fields"
|
||||||
value={selectedAdapter == null ? '' : selectedAdapter.id}
|
value={selectedAdapter == null ? '' : selectedAdapter.id}
|
||||||
optionList={adapter
|
optionList={adapter
|
||||||
|
.filter((a) => a != null)
|
||||||
.map((a) => {
|
.map((a) => {
|
||||||
return {
|
return {
|
||||||
otherKey: a.id,
|
|
||||||
value: a.id,
|
value: a.id,
|
||||||
label: a.name,
|
label: a.name,
|
||||||
};
|
};
|
||||||
@@ -238,7 +240,7 @@ export default function NotificationAdapterMutator({
|
|||||||
.filter((option) =>
|
.filter((option) =>
|
||||||
editNotificationAdapter != null
|
editNotificationAdapter != null
|
||||||
? true
|
? true
|
||||||
: selected.find((selectedOption) => selectedOption.id === option.key) == null,
|
: selected.find((selectedOption) => selectedOption.id === option.value) == null,
|
||||||
)
|
)
|
||||||
.sort(sortAdapter)}
|
.sort(sortAdapter)}
|
||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user