From d24b5f351822e7575a98b84f03bb4ba303f2f40e Mon Sep 17 00:00:00 2001 From: Ricardo Cino Date: Thu, 23 Jun 2022 03:22:52 +0200 Subject: fix: dont replace custom icon when service updates (#338) --- src/internal-server/app/Controllers/Http/ServiceController.js | 5 +++++ src/models/Service.js | 4 +--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/internal-server/app/Controllers/Http/ServiceController.js b/src/internal-server/app/Controllers/Http/ServiceController.js index 89091aa57..44e4a7369 100644 --- a/src/internal-server/app/Controllers/Http/ServiceController.js +++ b/src/internal-server/app/Controllers/Http/ServiceController.js @@ -147,6 +147,7 @@ class ServiceController { status: ['updated'], }); } + // Update service info const data = request.all(); const { id } = params; @@ -155,6 +156,10 @@ class ServiceController { const serviceQuery = await Service.query().where('serviceId', id).fetch(); const serviceData = serviceQuery.rows[0]; + if (data.customIcon === 'delete') { + data.iconId = ''; + } + const settings = { ...convertToJSON(serviceData.settings), ...data, diff --git a/src/models/Service.js b/src/models/Service.js index 1adb1998b..53285e440 100644 --- a/src/models/Service.js +++ b/src/models/Service.js @@ -127,9 +127,7 @@ export default class Service { this.name = ifUndefinedString(data.name, this.name); this.team = ifUndefinedString(data.team, this.team); this.customUrl = ifUndefinedString(data.customUrl, this.customUrl); - // this.customIconUrl = ifUndefinedString(data.customIconUrl, this.customIconUrl); this.iconUrl = ifUndefinedString(data.iconUrl, this.iconUrl); - this.order = ifUndefinedNumber(data.order, this.order); this.isEnabled = ifUndefinedBoolean(data.isEnabled, this.isEnabled); this.isNotificationEnabled = ifUndefinedBoolean( @@ -162,7 +160,7 @@ export default class Service { this.isProgressbarEnabled, ); this.hasCustomUploadedIcon = ifUndefinedBoolean( - data.hasCustomIcon, + data.iconId?.length > 0, this.hasCustomUploadedIcon, ); this.onlyShowFavoritesInUnreadCount = ifUndefinedBoolean( -- cgit v1.2.3-70-g09d2