From afc431e900624c87f0da4141bebce01b62005b17 Mon Sep 17 00:00:00 2001 From: moT01 Date: Thu, 29 Aug 2019 08:45:35 -0500 Subject: [PATCH] fix: restrict usernames that are keywords fix: the rest of the typo (unsunscribe to unsubscribe) fix: restrict copyright and copyright-policy and add appropriate redirects fix/forgot-to-save-this-file-before-last-commit fix: remove-duplicate+fix-typo fix: update-snapshot --- api-server/server/utils/constants.js | 18 +++++++++++++++--- .../create-redirects.test.js.snap | 6 ++++-- tools/scripts/build/create-redirects.js | 6 ++++-- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/api-server/server/utils/constants.js b/api-server/server/utils/constants.js index f9c75c636b..8efce06242 100644 --- a/api-server/server/utils/constants.js +++ b/api-server/server/utils/constants.js @@ -19,12 +19,17 @@ export const blacklistedUsernames = [ 'challenge-completed', 'challenges', 'chat', + 'code-of-conduct', 'coding-bootcamp-cost-calculator', 'completed-bonfire', 'completed-challenge', 'completed-field-guide', 'completed-zipline-or-basejump', + 'copyright', + 'copyright-policy', + 'deprecated-signin', 'donate', + 'email-signin', 'events', 'explorer', 'external', @@ -32,35 +37,42 @@ export const blacklistedUsernames = [ 'forgot', 'forum', 'get-help', - 'get-help', 'get-pai', 'guide', 'how-nonprofit-projects-work', 'internal', 'jobs', 'jobs-form', + 'learn', 'learn-to-code', 'login', 'logout', 'map', 'modern-challenge-completed', 'news', + 'nonprofit-project-instructions', 'nonprofits', - 'nonproifts-form', + 'nonprofits-form', 'open-api', + 'passwordless-change', 'pmi-acp-agile-project-managers', 'pmi-acp-agile-project-managers-form', 'privacy', - 'privacy', + 'privacy-policy', 'project-completed', 'reset', 'services', + 'shop', 'signin', 'signout', + 'signup', 'sitemap.xml', 'software-resources-for-nonprofits', + 'sponsors', 'stories', + 'support', 'terms', + 'terms-of-service', 'the-fastest-web-page-on-the-internet', 'twitch', 'unsubscribe', diff --git a/tools/scripts/build/__snapshots__/create-redirects.test.js.snap b/tools/scripts/build/__snapshots__/create-redirects.test.js.snap index d525e3f84e..7c70a5d855 100644 --- a/tools/scripts/build/__snapshots__/create-redirects.test.js.snap +++ b/tools/scripts/build/__snapshots__/create-redirects.test.js.snap @@ -13,6 +13,8 @@ exports[`createRedirects matches the snapshot 1`] = ` /about https://news.example.com/about 200 /academic-honesty https://news.example.com/academic-honesty 200 /code-of-conduct https://news.example.com/code-of-conduct 200 +/copyright https://news.example.com/copyright-policy 200 +/copyright-policy https://news.example.com/copyright-policy 200 /privacy https://news.example.com/privacy-policy 200 /privacy-policy https://news.example.com/privacy-policy 200 /sponsors https://news.example.com/sponsors 200 @@ -41,9 +43,9 @@ exports[`createRedirects matches the snapshot 1`] = ` /:username/back-end-certification /certification/:username/legacy-back-end 301 /:username/full-stack-certification /certification/:username/full-stack 301 -# unsunscribe redirects +# unsubscribe redirects /u/* https://api.example.com/u/:splat 200 -/unsunscribe/* https://api.example.com/unsunscribe/:splat 200 +/unsubscribe/* https://api.example.com/unsubscribe/:splat 200 /ue/* https://api.example.com/ue/:splat 200 # misc redirects diff --git a/tools/scripts/build/create-redirects.js b/tools/scripts/build/create-redirects.js index cdfd81d913..99eedd439e 100644 --- a/tools/scripts/build/create-redirects.js +++ b/tools/scripts/build/create-redirects.js @@ -34,6 +34,8 @@ const template = ` /about #{{NEWS}}/about 200 /academic-honesty #{{NEWS}}/academic-honesty 200 /code-of-conduct #{{NEWS}}/code-of-conduct 200 +/copyright #{{NEWS}}/copyright-policy 200 +/copyright-policy #{{NEWS}}/copyright-policy 200 /privacy #{{NEWS}}/privacy-policy 200 /privacy-policy #{{NEWS}}/privacy-policy 200 /sponsors #{{NEWS}}/sponsors 200 @@ -62,9 +64,9 @@ const template = ` /:username/back-end-certification /certification/:username/legacy-back-end 301 /:username/full-stack-certification /certification/:username/full-stack 301 -# unsunscribe redirects +# unsubscribe redirects /u/* #{{API}}/u/:splat 200 -/unsunscribe/* #{{API}}/unsunscribe/:splat 200 +/unsubscribe/* #{{API}}/unsubscribe/:splat 200 /ue/* #{{API}}/ue/:splat 200 # misc redirects