Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug fix. ExternalViews are not deserialized correctly on client side #1114

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions config-examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -635,3 +635,9 @@ customization:
urlShortener: |
// also available: context.clientIp
return request.get('http://tinyurl.com/api-create.php?url=' + encodeURIComponent(url))
externalViews:
- title: Example externalView
linkGenerator: >
{
return 'http://www.example.com';
}
27 changes: 27 additions & 0 deletions cypress/e2e/externalview.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright 2017-2022 Allegro.pl
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

describe('ExternalView', () => {
it('open share menu and find example externalView', () => {
cy.visit('http://localhost:9090/#covid19/4/N4IgbglgzgrghgGwgLzgFwgewHYgFwhqZqJQgA0408SqGOAygKZobYDmZe2MCClGALZNkOJvhABRNAGMA9AFUAKgGEKIAGYQEaJgCcuAbVBoAngAdxBIeMp6mGiTfU2ACvqwATI6E8w96Fi4BK4AjACa6lC65vgAtKECFlYgCOhM0SAAvgC6uZRQ5khoRjkFHhn4xiD2GvpM2DIpMnBQlZQamHqC6PgmyRKeDnC8aOpgiDAp2UmWEsKt/uJZ5KC19Y0pQ+gAFmQdXT1jeP1zBEMaIzrjk9MrhAMEC7D2M2sOG01OGSXqnd29E4PM4gC5XMaUCYIKYSGbAlLPJZvGofeybCQTGQyCDYQI4faaQ6A05bYajG7Qu6zBFMRavfIgcw47BMTwAEQgwmwUCCRlSmBa9FwZUZzNZDC6xxALTaZCyQA=')

cy.get('div.icon-button:nth-child(3)').click()
cy.contains('Example externalView')
})
})



3 changes: 2 additions & 1 deletion src/client/deserializers/customization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@
import { Timezone } from "chronoshift";
import { ClientCustomization, SerializedCustomization } from "../../common/models/customization/customization";
import { deserialize as deserializeLocale } from "../../common/models/locale/locale";
import { ExternalView } from "../../common/models/external-view/external-view";

export function deserialize(customization: SerializedCustomization): ClientCustomization {
const { headerBackground, messages, locale, customLogoSvg, timezones, externalViews, hasUrlShortener, sentryDSN, visualizationColors } = customization;
return {
headerBackground,
customLogoSvg,
externalViews,
externalViews: externalViews.map(ExternalView.fromJS),
hasUrlShortener,
sentryDSN,
messages,
Expand Down