Skip to content

Commit

Permalink
remove old zendesk code (#4292)
Browse files Browse the repository at this point in the history
  • Loading branch information
martyn-w authored Oct 29, 2024
1 parent 44eab36 commit 5bb131c
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 55 deletions.
2 changes: 0 additions & 2 deletions app/components/footer_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,3 @@
</div>
</div>
</footer>

<%= render "sections/zendesk_chat_settings" %>
11 changes: 0 additions & 11 deletions app/views/sections/_zendesk_chat_settings.html.erb

This file was deleted.

7 changes: 0 additions & 7 deletions app/webpacker/javascript/zendesk_chat_reload.js

This file was deleted.

1 change: 0 additions & 1 deletion app/webpacker/packs/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ require.context('../images', true);
require.context('../documents', true);

require('../javascript/perfume');
require('../javascript/zendesk_chat_reload');

Rails.start();
Turbolinks.start();
Expand Down
9 changes: 4 additions & 5 deletions config/initializers/secure_headers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
google_doubleclick = %w[*.doubleclick.net *.googleads.g.doubleclick.net *.ad.doubleclick.net *.fls.doubleclick.net stats.g.doubleclick.net]
google_apis = %w[*.googleapis.com googleapis.com https://fonts.googleapis.com]

zendesk = %w[wss://api.eu-1.smooch.io/faye api.eu-1.smooch.io *.zendesk.com static.zdassets.com https://*.zopim.com wss://*.zopim.com dfesupport-tpuk.zendesk.com ekr.zdassets.com]
facebook = %w[*.facebook.com *.facebook.net *.connect.facebook.net]
govuk = %w[*.gov.uk www.gov.uk]
jquery = %w[code.jquery.com]
Expand All @@ -51,7 +50,7 @@

# We're not sure why yet but the asset host needs to be
# explicitly whitelisted in the media_src directive or the CSP
#  blocks videos from loading. We don't appear to have this issue
# blocks videos from loading. We don't appear to have this issue
# with the img_src, oddly.
assets = []
assets << ENV["APP_ASSETS_URL"] if ENV["APP_ASSETS_URL"].present?
Expand All @@ -64,15 +63,15 @@
default_src: %w['none'],
base_uri: self_base,
child_src: self_base.concat(youtube, pinterest, snapchat),
connect_src: self_base.concat(google_apis, pinterest, google_analytics, google_supported, google_doubleclick, facebook, zendesk, snapchat, sentry, gtm_server, clarity, vwo),
connect_src: self_base.concat(google_apis, pinterest, google_analytics, google_supported, google_doubleclick, facebook, snapchat, sentry, gtm_server, clarity, vwo),
font_src: self_base.concat(govuk, data, %w[fonts.gstatic.com]),
form_action: self_base.concat(snapchat, facebook, govuk),
frame_src: self_base.concat(snapchat, facebook, youtube, google_doubleclick, google_analytics, data, pinterest, clarity, vwo),
frame_ancestors: self_base,
img_src: self_base.concat(govuk, pinterest, facebook, youtube, twitter, google_supported, google_adservice, google_apis, google_analytics, google_doubleclick, data, lid_pixels, gtm_server, reddit, clarity, vwo, %w[chart.googleapis.com wingify-assets.s3.amazonaws.com cx.atdmt.com linkbam.uk]),
manifest_src: self_base,
media_src: self_base.concat(zendesk).concat(assets),
script_src: quoted_unsafe_inline + quoted_unsafe_eval + self_base.concat(google_analytics, google_supported, google_apis, lid_pixels, govuk, facebook, jquery, pinterest, twitter, snapchat, youtube, zendesk, reddit, clarity, vwo),
media_src: self_base.concat(assets),
script_src: quoted_unsafe_inline + quoted_unsafe_eval + self_base.concat(google_analytics, google_supported, google_apis, lid_pixels, govuk, facebook, jquery, pinterest, twitter, snapchat, youtube, reddit, clarity, vwo),
style_src: quoted_unsafe_inline + self_base.concat(govuk, google_apis, google_supported, vwo),
worker_src: self_base.concat(blob),
}
Expand Down
9 changes: 0 additions & 9 deletions spec/components/footer_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,4 @@
expect(page).not_to have_css(talk_to_us_selector)
end
end

describe "Zendesk Chat settings snippet" do
subject! do
render_inline(described_class.new)
page.native.inner_html
end

it { is_expected.to include("window.zESettings") }
end
end
27 changes: 7 additions & 20 deletions spec/javascript/controllers/chat_controller_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ describe('ChatController', () => {
beforeAll(() => registerController());
afterEach(() => jest.useRealTimers());

let chatShowSpy;
let chatOpenSpy;

const setBody = (chatAvailable = 'true') => {
document.body.innerHTML = `
<div data-controller="chat" data-available="${chatAvailable}" data-chat-target="container" class="chat">
Expand All @@ -29,8 +26,6 @@ describe('ChatController', () => {
</p>
</div>
</div>
<iframe id="webWidget"></iframe> // Zendesk modal.
`;
}

Expand All @@ -39,23 +34,15 @@ describe('ChatController', () => {
application.register('chat', ChatController);
}

const setCurrentTime = (time) => {
jest.useFakeTimers().setSystemTime(new Date(time).getTime())
}

const getButtonText = () => {
return document.querySelector('a').textContent;
const mockFetch = (result) => {
global.fetch = jest.fn(() => {
return Promise.resolve({
json: () => (result)
})
})
}

describe('when the new chat is enabled', () => {

const mockFetch = (result) => {
global.fetch = jest.fn(() => {
return Promise.resolve({
json: () => (result)
})
})
}
describe('chat', () => {

describe('when the chat is online', () => {
beforeEach(() => {
Expand Down

0 comments on commit 5bb131c

Please sign in to comment.