From ef3f9778aa81f8ed39dcd835d63d94f2248e0204 Mon Sep 17 00:00:00 2001 From: sct Date: Mon, 26 Apr 2021 08:22:50 +0900 Subject: [PATCH] fix(api): do not try to transform empty values passed to user notificationTypes fixes #1501 --- server/entity/UserSettings.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/entity/UserSettings.ts b/server/entity/UserSettings.ts index e710b0a29..9b602a5be 100644 --- a/server/entity/UserSettings.ts +++ b/server/entity/UserSettings.ts @@ -86,7 +86,11 @@ export class UserSettings { return values; }, - to: (value: Partial): string => { + to: (value: Partial): string | null => { + if (!value || typeof value !== 'object') { + return null; + } + const allowedKeys = Object.values(NotificationAgentKey); // Remove any unknown notification agent keys before saving to db