From e6b3ff153b74987904359aa35347d641227a5e39 Mon Sep 17 00:00:00 2001 From: Joe Baker <7987787+JBR90@users.noreply.github.com> Date: Wed, 10 May 2023 20:04:03 +0100 Subject: [PATCH 1/9] fix: add no theme into learning themes --- .../curriculum-api/fixtures/unitListing.fixture.ts | 13 ++++++++++++- src/node-lib/curriculum-api/index.test.ts | 12 ++++++++++++ src/node-lib/curriculum-api/index.ts | 3 +-- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/node-lib/curriculum-api/fixtures/unitListing.fixture.ts b/src/node-lib/curriculum-api/fixtures/unitListing.fixture.ts index 1553061dac..59dcd2167b 100644 --- a/src/node-lib/curriculum-api/fixtures/unitListing.fixture.ts +++ b/src/node-lib/curriculum-api/fixtures/unitListing.fixture.ts @@ -268,7 +268,18 @@ const unitListingFixture = ( expiredLessonCount: 0, }, ], - learningThemes: [], + learningThemes: [ + { + learningThemeTitle: "The Canterbury Tales and paired texts", + learningThemeSlug: "the-canterbury-tales-and-paired-texts-39", + }, + { + learningThemeTitle: "The sonnet through time", + learningThemeSlug: "the-sonnet-through-time-24", + }, + + { learningThemeTitle: "", learningThemeSlug: "no-theme" }, + ], ...partial, }; }; diff --git a/src/node-lib/curriculum-api/index.test.ts b/src/node-lib/curriculum-api/index.test.ts index 4117f4b028..e467ab712e 100644 --- a/src/node-lib/curriculum-api/index.test.ts +++ b/src/node-lib/curriculum-api/index.test.ts @@ -136,6 +136,18 @@ describe("curriculum-api", () => { programmeSlug: "maths-secondary-ks4", }); }); + test("unitListing learningThemes contains 'no themes'", async () => { + const units = await curriculumApi.unitListing({ + programmeSlug: "maths-secondary-ks4", + }); + const hasThemes = + units.learningThemes?.filter( + (theme) => theme.learningThemeSlug === "no-theme" + ).length > 0; + + console.log(hasThemes); + expect(hasThemes).toBe(true); + }); test("lessonListingPaths", async () => { await curriculumApi.lessonListingPaths(); expect(lessonListingPaths).toHaveBeenCalled(); diff --git a/src/node-lib/curriculum-api/index.ts b/src/node-lib/curriculum-api/index.ts index 0ca483c670..a1d45be486 100644 --- a/src/node-lib/curriculum-api/index.ts +++ b/src/node-lib/curriculum-api/index.ts @@ -419,10 +419,9 @@ const curriculumApi = { const programme = getFirstResultOrWarnOrFail()({ results: programmes }); const learningThemes = units - ?.filter((unit) => unit?.themeSlug !== "no-theme") .map((unitWithTheme) => ({ learningThemeSlug: unitWithTheme?.themeSlug || "", - learningThemeTitle: unitWithTheme?.themeTitle || "", + learningThemeTitle: unitWithTheme?.themeTitle || "No theme", })) .sort((a, b) => { if (a.learningThemeTitle < b.learningThemeTitle) { From 74928f4f94b5bd6fb349641d563c29a7bf4061d2 Mon Sep 17 00:00:00 2001 From: Joe Baker <7987787+JBR90@users.noreply.github.com> Date: Thu, 11 May 2023 08:54:49 +0100 Subject: [PATCH 2/9] chore: remove log --- src/node-lib/curriculum-api/index.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/node-lib/curriculum-api/index.test.ts b/src/node-lib/curriculum-api/index.test.ts index e467ab712e..b058f52f19 100644 --- a/src/node-lib/curriculum-api/index.test.ts +++ b/src/node-lib/curriculum-api/index.test.ts @@ -145,7 +145,6 @@ describe("curriculum-api", () => { (theme) => theme.learningThemeSlug === "no-theme" ).length > 0; - console.log(hasThemes); expect(hasThemes).toBe(true); }); test("lessonListingPaths", async () => { From 0b8b97e5f208fca068f4f7c66177f5bb9439b0e6 Mon Sep 17 00:00:00 2001 From: Jim Cresswell Date: Thu, 11 May 2023 14:40:42 +0100 Subject: [PATCH 3/9] docs(security): communicate GitHub private vulnerability reporting option --- public/.well-known/security.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/public/.well-known/security.txt b/public/.well-known/security.txt index d9f149f587..e3bbe1ab81 100644 --- a/public/.well-known/security.txt +++ b/public/.well-known/security.txt @@ -11,6 +11,8 @@ Preferred-Languages: en Encryption: https://www.thenational.academy/.well-known/pgp-key.txt Encryption: https://keys.openpgp.org/vks/v1/by-fingerprint/E925058764BF1E055A95CFA7971F062051B60B7D +Alternatively please follow the GitHub private vulnerability reporting steps https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing/privately-reporting-a-security-vulnerability . + # This security is annually reviewed Expires: 2023-07-31T20:59:00.000Z From e3d0d5e9cb6e101d78e999574ff00a1aab489f11 Mon Sep 17 00:00:00 2001 From: Joe Baker <7987787+JBR90@users.noreply.github.com> Date: Thu, 11 May 2023 15:24:11 +0100 Subject: [PATCH 4/9] refactor: filtering and sorting learning themes --- .../fixtures/unitListing.fixture.ts | 2 +- src/node-lib/curriculum-api/index.ts | 45 ++++++++----------- 2 files changed, 20 insertions(+), 27 deletions(-) diff --git a/src/node-lib/curriculum-api/fixtures/unitListing.fixture.ts b/src/node-lib/curriculum-api/fixtures/unitListing.fixture.ts index 59dcd2167b..5ce590a77d 100644 --- a/src/node-lib/curriculum-api/fixtures/unitListing.fixture.ts +++ b/src/node-lib/curriculum-api/fixtures/unitListing.fixture.ts @@ -278,7 +278,7 @@ const unitListingFixture = ( learningThemeSlug: "the-sonnet-through-time-24", }, - { learningThemeTitle: "", learningThemeSlug: "no-theme" }, + { learningThemeTitle: null, learningThemeSlug: "no-theme" }, ], ...partial, }; diff --git a/src/node-lib/curriculum-api/index.ts b/src/node-lib/curriculum-api/index.ts index a1d45be486..acb35e1066 100644 --- a/src/node-lib/curriculum-api/index.ts +++ b/src/node-lib/curriculum-api/index.ts @@ -315,8 +315,8 @@ const unitListingData = z.object({ units: unitsData, learningThemes: z.array( z.object({ - learningThemeTitle: z.string(), - learningThemeSlug: z.string(), + learningThemeTitle: z.string().nullable(), + learningThemeSlug: z.string().nullable(), }) ), }); @@ -418,33 +418,26 @@ const curriculumApi = { const { units = [], programmes = [], tiers = [] } = transformMVCase(res); const programme = getFirstResultOrWarnOrFail()({ results: programmes }); - const learningThemes = units - .map((unitWithTheme) => ({ - learningThemeSlug: unitWithTheme?.themeSlug || "", - learningThemeTitle: unitWithTheme?.themeTitle || "No theme", - })) - .sort((a, b) => { - if (a.learningThemeTitle < b.learningThemeTitle) { - return -1; - } - if (a.learningThemeTitle > b.learningThemeTitle) { - return 1; - } - return 0; - }); + const learningThemes = units.map((unitWithTheme) => ({ + learningThemeSlug: unitWithTheme?.themeSlug, + learningThemeTitle: unitWithTheme?.themeTitle || "No theme", + })); // !Refactor index signature to be more specific - type LearningTheme = { - [key: string]: string; - }; - - const filteredDuplicatedLearningThemes = learningThemes.filter( - (learningTheme: LearningTheme, index, learningThemeToCompare) => - learningThemeToCompare.findIndex((lt: LearningTheme) => - ["learningThemeSlug"].every((l) => lt[l] === learningTheme[l]) - ) === index - ); + const filteredDuplicatedLearningThemes = [ + ...new Map( + learningThemes.map((theme) => [JSON.stringify(theme), theme]) + ).values(), + ].sort((a, b) => { + if (a.learningThemeTitle < b.learningThemeTitle) { + return -1; + } + if (a.learningThemeTitle > b.learningThemeTitle) { + return 1; + } + return 0; + }); return unitListingData.parse({ programmeSlug: programme?.programmeSlug, From c02c502d5c1bc51f57042144a9462da575037e52 Mon Sep 17 00:00:00 2001 From: Joe Baker <7987787+JBR90@users.noreply.github.com> Date: Thu, 11 May 2023 15:30:08 +0100 Subject: [PATCH 5/9] fix: type errors --- .../LearningThemeFilters/LearningThemeFilters.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/Filters/LearningThemeFilters/LearningThemeFilters.tsx b/src/components/Filters/LearningThemeFilters/LearningThemeFilters.tsx index 121c7c21dc..7605305d04 100644 --- a/src/components/Filters/LearningThemeFilters/LearningThemeFilters.tsx +++ b/src/components/Filters/LearningThemeFilters/LearningThemeFilters.tsx @@ -11,8 +11,8 @@ export type LearningThemeSelectedTrackingProps = { }; export type LearningTheme = { - learningThemeSlug?: string; - learningThemeTitle?: string; + learningThemeSlug?: string | null; + learningThemeTitle?: string | null; }; export type LearningThemeFiltersProps = { @@ -48,12 +48,12 @@ const LearningThemeFilters = ({ .sort( ( a: { - label: string | undefined; - slug: string | undefined; + label: string | undefined | null; + slug: string | undefined | null; }, b: { - label: string | undefined; - slug: string | undefined; + label: string | undefined | null; + slug: string | undefined | null; } ) => { if (a?.slug === "no-theme") { From 0c1dfc162d3d264787653f7408414e6d0b0d0530 Mon Sep 17 00:00:00 2001 From: John Roberts Date: Thu, 11 May 2023 15:38:19 +0100 Subject: [PATCH 6/9] docs(security): update and sign security.txt Align with proposed RFC for security.txt and re-generate PGP signature --- public/.well-known/security.txt | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/public/.well-known/security.txt b/public/.well-known/security.txt index e3bbe1ab81..6126234f64 100644 --- a/public/.well-known/security.txt +++ b/public/.well-known/security.txt @@ -5,14 +5,13 @@ Hash: SHA256 # Please report any security vulnerabilities to us via the contact method(s) below, only after reading our security disclosure policy. Contact: mailto:security@thenational.academy +Contact: https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing/privately-reporting-a-security-vulnerability Preferred-Languages: en # Encrypt your messages to Oak National Academy using the PGP key below Encryption: https://www.thenational.academy/.well-known/pgp-key.txt Encryption: https://keys.openpgp.org/vks/v1/by-fingerprint/E925058764BF1E055A95CFA7971F062051B60B7D -Alternatively please follow the GitHub private vulnerability reporting steps https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing/privately-reporting-a-security-vulnerability . - # This security is annually reviewed Expires: 2023-07-31T20:59:00.000Z @@ -31,17 +30,17 @@ Hiring: https://jobs.thenational.academy # Please see https://securitytxt.org/ for details of the specification of this file -----BEGIN PGP SIGNATURE----- -iQIzBAEBCAAdFiEE6SUFh2S/HgValc+nlx8GIFG2C30FAmPihxMACgkQlx8GIFG2 -C31pAA//ds+Ytm1eqGx0a5PlrKdpajAr3HCgjYPetNfeid/fPcHuOUymUsAmS8h3 -hBzxdpRJfpH34tzJU0ZUz6jDpY2JqpIe7m+tc35q4IySmqxKwnAV/SfemNIxb2A+ -L04aekGp+GVaoBf+ZlHxlQEGgP2Z9ne7gO1Pc+HfkzU4vYeK5/9C+6pLk9bVnxau -LM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fSbTW1VZ73g1+otILluXBA7ghTvKJyHCUi42ZmxneNLJqLjERZ7lmJLk +hgnhOLQ9f7WgMqD4LkxIaV1Tb8j/frxbd2JrQR8Ht3oUe5mfTWV8Oku8BsUJ5GhN +XuV3a9148NKBHtnB9pJsgqVo8TLGa8c7fQFaXOAQ68+GCYp/Dmy17sX9lTyruZIy +dJMGcpZ2HlP0LFQn1BBaNGDwKY44LFHnnNrTOZ12nrtLlDp3lNc= +=v60q +-----END PGP SIGNATURE----- From be40d8d44110af4c398705c4a36d580d9e2feb50 Mon Sep 17 00:00:00 2001 From: Jim Cresswell Date: Thu, 11 May 2023 15:40:11 +0100 Subject: [PATCH 7/9] fix(security policy): meet formatting standard --- public/.well-known/security.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/public/.well-known/security.txt b/public/.well-known/security.txt index e3bbe1ab81..2bb4f0750a 100644 --- a/public/.well-known/security.txt +++ b/public/.well-known/security.txt @@ -5,14 +5,13 @@ Hash: SHA256 # Please report any security vulnerabilities to us via the contact method(s) below, only after reading our security disclosure policy. Contact: mailto:security@thenational.academy +Contact: https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing/privately-reporting-a-security-vulnerability Preferred-Languages: en # Encrypt your messages to Oak National Academy using the PGP key below Encryption: https://www.thenational.academy/.well-known/pgp-key.txt Encryption: https://keys.openpgp.org/vks/v1/by-fingerprint/E925058764BF1E055A95CFA7971F062051B60B7D -Alternatively please follow the GitHub private vulnerability reporting steps https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing/privately-reporting-a-security-vulnerability . - # This security is annually reviewed Expires: 2023-07-31T20:59:00.000Z From a3d9b2d20131a807d254262a4d048ff84d4a8f5c Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Thu, 11 May 2023 15:03:31 +0000 Subject: [PATCH 8/9] build(release v1.181.1): See CHANGE_LOG.md --- CHANGE_LOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGE_LOG.md b/CHANGE_LOG.md index f115caa284..ae2d8103cb 100644 --- a/CHANGE_LOG.md +++ b/CHANGE_LOG.md @@ -1,3 +1,10 @@ +## [1.181.1](https://github.com/oaknational/Oak-Web-Application/compare/v1.181.0...v1.181.1) (2023-05-11) + + +### Bug Fixes + +* **security policy:** meet formatting standard ([be40d8d](https://github.com/oaknational/Oak-Web-Application/commit/be40d8d44110af4c398705c4a36d580d9e2feb50)) + # [1.181.0](https://github.com/oaknational/Oak-Web-Application/compare/v1.180.3...v1.181.0) (2023-05-11) From 2bc7d872d85d87fdc14a1688271fde8d9b9106eb Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Thu, 11 May 2023 15:38:42 +0000 Subject: [PATCH 9/9] build(release v1.181.2): See CHANGE_LOG.md --- CHANGE_LOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGE_LOG.md b/CHANGE_LOG.md index ae2d8103cb..9b257bf0a8 100644 --- a/CHANGE_LOG.md +++ b/CHANGE_LOG.md @@ -1,3 +1,11 @@ +## [1.181.2](https://github.com/oaknational/Oak-Web-Application/compare/v1.181.1...v1.181.2) (2023-05-11) + + +### Bug Fixes + +* add no theme into learning themes ([e6b3ff1](https://github.com/oaknational/Oak-Web-Application/commit/e6b3ff153b74987904359aa35347d641227a5e39)) +* type errors ([c02c502](https://github.com/oaknational/Oak-Web-Application/commit/c02c502d5c1bc51f57042144a9462da575037e52)) + ## [1.181.1](https://github.com/oaknational/Oak-Web-Application/compare/v1.181.0...v1.181.1) (2023-05-11)