-
Notifications
You must be signed in to change notification settings - Fork 266
[WORLDSERVICE-464] Remove sw.js for Public Services #12566
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
Changes from 2 commits
023e582
c823c44
9b2989b
cc31758
c210d37
5bf38c4
16f79f4
643a20d
c3479eb
4f4d5bb
7f46c5e
2b57114
0434dbc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -22,11 +22,6 @@ export const getArticleRegex = services => { | |||||||||||||
| return `/:service(${serviceRegex})?:discipline(${sportDisciplineRegex})?/:local(${articleLocalRegex})/:id(${idRegex}):variant(${variantRegex})?:nonCanonicalArticleRenderPlatform(${nonCanonicalArticleRenderPlatform})?`; | ||||||||||||||
| }; | ||||||||||||||
|
|
||||||||||||||
| export const getArticleSwRegex = services => { | ||||||||||||||
karinathomasbbc marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
| const serviceRegex = getServiceRegex(services); | ||||||||||||||
| return `/:service(${serviceRegex})/:local(${articleLocalRegex})/sw.js`; | ||||||||||||||
| }; | ||||||||||||||
|
|
||||||||||||||
| const getWorldServices = services => { | ||||||||||||||
| const publicServices = [ | ||||||||||||||
| 'news', | ||||||||||||||
|
|
@@ -35,11 +30,17 @@ const getWorldServices = services => { | |||||||||||||
| 'cymrufyw', | ||||||||||||||
| 'naidheachdan', | ||||||||||||||
| 'archive', | ||||||||||||||
| 'scotland', | ||||||||||||||
| ]; | ||||||||||||||
|
|
||||||||||||||
| return services.filter(service => !publicServices.includes(service)); | ||||||||||||||
| }; | ||||||||||||||
|
|
||||||||||||||
| export const getArticleSwRegex = services => { | ||||||||||||||
| const serviceRegex = getServiceRegex(getWorldServices(services)); | ||||||||||||||
| return `/:service(${serviceRegex})/:local(${articleLocalRegex})/sw.js`; | ||||||||||||||
|
||||||||||||||
| return `/:service(${serviceRegex})/:local(${articleLocalRegex})/sw.js`; | |
| return `/:service(${serviceRegex})/articles/sw.js`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. Updated
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is potentially out of scope (or is it? - Let's get a second opinion!) Let's do this while we're here: per my comment above anything that uses getWorldServices no longer needs articleLocalRegex. If we did change it, we would also need to update some tests.
(Note that this we recently removed manifest paths from Public Services, and we just missed this.
| export const getArticleManifestRegex = services => { | |
| const serviceRegex = getServiceRegex(getWorldServices(services)); | |
| return `/:service(${serviceRegex})/:local(${articleLocalRegex})/manifest.json`; | |
| export const getArticleManifestRegex = services => { | |
| const serviceRegex = getServiceRegex(getWorldServices(services)); | |
| return `/:service(${serviceRegex})/articles/manifest.json`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense. Updated
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -953,7 +953,7 @@ describe('Server', () => { | |
|
|
||
| describe('Service workers', () => { | ||
| it('should serve a file for existing service workers', async () => { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we make sure there's still a test for existence of
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops, we should def keep it. Updated |
||
| await makeRequest('/news/articles/sw.js'); | ||
| await makeRequest('/gahuza/articles/sw.js'); | ||
| expect(sendFileSpy.mock.calls[0][0]).toEqual( | ||
| path.join(__dirname, '/public/sw.js'), | ||
| ); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am wondering whether to add examples of all sw paths which are now invalid, for all Public Services? Especially if we have excluded them explictly from the regex.
So this would be:
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, updated