Skip to content

Commit

Permalink
fix: remove resources_name and add support for url (#490)
Browse files Browse the repository at this point in the history
* fix: remove resources_name and add support for url

* fix: display url parameter as domain but store with https scheme

* fix: resolve failing tests
  • Loading branch information
dcshzj authored Aug 18, 2022
1 parent e586257 commit 2b3cdb0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/fixtures/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ const configContent = {
const configSha = "configsha"

const configResponse = {
url: configContent.url,
url: configContent.url.replace("https://", ""),
title: configContent.title,
description: configContent.description,
favicon: configContent.favicon,
Expand All @@ -127,7 +127,6 @@ const configResponse = {
facebook_pixel: configContent["facebook-pixel"],
google_analytics: configContent.google_analytics,
linkedin_insights: configContent["linkedin-insights"],
resources_name: configContent.resources_name,
colors: configContent.colors,
}

Expand Down
12 changes: 9 additions & 3 deletions src/services/configServices/SettingsService.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ class SettingsService {
config.content,
updatedConfigContent
)
// Prepend "https://" to url parameter if parameter is defined
if (
mergedConfigContent.url !== "" &&
!mergedConfigContent.url.startsWith("https://")
) {
mergedConfigContent.url = "https://" + mergedConfigContent.url
}

await this.configYmlService.update(reqDetails, {
fileContent: mergedConfigContent,
sha: config.sha,
Expand Down Expand Up @@ -152,7 +160,7 @@ class SettingsService {

static extractConfigFields(config) {
return {
url: config.content.url,
url: config.content.url.replace("https://", ""),
description: config.content.description,
title: config.content.title,
favicon: config.content.favicon,
Expand All @@ -161,7 +169,6 @@ class SettingsService {
facebook_pixel: config.content["facebook-pixel"],
google_analytics: config.content.google_analytics,
linkedin_insights: config.content["linkedin-insights"],
resources_name: config.content.resources_name,
colors: config.content.colors,
}
}
Expand All @@ -187,7 +194,6 @@ class SettingsService {
"facebook-pixel",
"google_analytics",
"linkedin-insights",
"resources_name",
"colors",
]
const footerParams = [
Expand Down
1 change: 1 addition & 0 deletions src/validators/RequestSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ const UpdateNavigationRequestSchema = Joi.object().keys({
})

const UpdateSettingsRequestSchema = Joi.object().keys({
url: Joi.string().domain().allow(""),
colors: Joi.object().keys({
"primary-color": Joi.string().required(),
"secondary-color": Joi.string().required(),
Expand Down

0 comments on commit 2b3cdb0

Please sign in to comment.