diff options
author | Vijay A <avijayr@protonmail.com> | 2021-08-23 11:45:19 +0530 |
---|---|---|
committer | Vijay Raghavan Aravamudhan <vraravam@users.noreply.github.com> | 2021-08-23 12:19:02 +0530 |
commit | 933e3cea5c96a13f9141da4d37d374cf022e2718 (patch) | |
tree | f849f9b0469dc7248afab02c74f081439013083c /src/stores | |
parent | refactor: Reuse constants and utility functions to remove hardcoding/duplication (diff) | |
download | ferdium-app-933e3cea5c96a13f9141da4d37d374cf022e2718.tar.gz ferdium-app-933e3cea5c96a13f9141da4d37d374cf022e2718.tar.zst ferdium-app-933e3cea5c96a13f9141da4d37d374cf022e2718.zip |
fix: Fixing bug where the service-defaults are not merged
(when a user signs up for a service)
Diffstat (limited to 'src/stores')
-rw-r--r-- | src/stores/ServicesStore.js | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js index 5610f7a22..ccd8e2cb9 100644 --- a/src/stores/ServicesStore.js +++ b/src/stores/ServicesStore.js | |||
@@ -400,7 +400,8 @@ export default class ServicesStore extends Store { | |||
400 | 400 | ||
401 | // set default values for serviceData | 401 | // set default values for serviceData |
402 | // eslint-disable-next-line prefer-object-spread | 402 | // eslint-disable-next-line prefer-object-spread |
403 | Object.assign( | 403 | // TODO: How is this different from the defaults of the recipe in 'src/models/Recipe' file? |
404 | serviceData = Object.assign( | ||
404 | { | 405 | { |
405 | isEnabled: true, | 406 | isEnabled: true, |
406 | isHibernationEnabled: false, | 407 | isHibernationEnabled: false, |
@@ -416,11 +417,7 @@ export default class ServicesStore extends Store { | |||
416 | serviceData, | 417 | serviceData, |
417 | ); | 418 | ); |
418 | 419 | ||
419 | let data = serviceData; | 420 | const data = skipCleanup ? serviceData : this._cleanUpTeamIdAndCustomUrl(recipeId, serviceData); |
420 | |||
421 | if (!skipCleanup) { | ||
422 | data = this._cleanUpTeamIdAndCustomUrl(recipeId, serviceData); | ||
423 | } | ||
424 | 421 | ||
425 | const response = await this.createServiceRequest.execute(recipeId, data) | 422 | const response = await this.createServiceRequest.execute(recipeId, data) |
426 | ._promise; | 423 | ._promise; |
@@ -452,12 +449,13 @@ export default class ServicesStore extends Store { | |||
452 | serviceData.name = data.name; | 449 | serviceData.name = data.name; |
453 | } | 450 | } |
454 | 451 | ||
455 | if (data.team && !data.customURL) { | 452 | if (data.team) { |
456 | serviceData.team = data.team; | 453 | if (!data.customURL) { |
457 | } | 454 | serviceData.team = data.team; |
458 | 455 | } else { | |
459 | if (data.team && data.customURL) { | 456 | // TODO: Is this correct? |
460 | serviceData.customUrl = data.team; | 457 | serviceData.customUrl = data.team; |
458 | } | ||
461 | } | 459 | } |
462 | 460 | ||
463 | this.actions.service.createService({ | 461 | this.actions.service.createService({ |