From aa5a62d49da65d24880dae656791aa550c498515 Mon Sep 17 00:00:00 2001 From: Sarah Schneider Date: Tue, 29 Sep 2020 13:36:07 -0400 Subject: [PATCH] Remove versions feature flag code (#15793) * remove FEATURE_NEW_VERSIONS from feature-flags.json * remove process.env.FEATURE_NEW_VERSIONS from include files * remove process.env.FEATURE_NEW_VERSIONS from lib files * remove process.env.FEATURE_NEW_VERSIONS from middleware files * remove process.env.FEATURE_NEW_VERSIONS from script files * remove process.env.FEATURE_NEW_VERSIONS from test files * update test fixtures to use new versions as canonical fixtures --- feature-flags.json | 3 +- includes/article-version-switcher.html | 8 - includes/deprecation-banner.html | 3 - includes/header.html | 8 +- includes/landing.html | 7 +- includes/sidebar-homepage.html | 15 +- includes/sidebar-specific-product.html | 4 - includes/support.html | 4 - lib/all-products.js | 40 +- lib/all-versions.js | 84 +- lib/check-developer-links.js | 4 +- lib/check-links.js | 4 +- lib/find-page.js | 4 +- lib/frontmatter.js | 32 +- lib/get-applicable-versions.js | 89 +- lib/liquid-tags/link.js | 4 +- lib/non-enterprise-default-version.js | 8 +- lib/page.js | 13 +- lib/path-utils.js | 129 +-- lib/permalink.js | 22 +- .../get-docs-path-from-developer-path.js | 11 +- lib/redirects/get-old-paths-from-permalink.js | 98 ++- lib/redirects/precompile.js | 20 +- lib/remove-deprecated-frontmatter.js | 12 +- lib/rewrite-asset-paths-to-s3.js | 34 +- lib/rewrite-local-links.js | 4 +- lib/site-tree.js | 15 +- middleware/breadcrumbs.js | 92 +- middleware/context.js | 39 +- middleware/contextualizers/graphql.js | 4 +- middleware/contextualizers/rest.js | 4 +- middleware/contextualizers/webhooks.js | 4 +- middleware/featured-links.js | 4 +- middleware/index.js | 3 - middleware/notices.js | 4 +- script/get-new-version-path.js | 1 - script/graphql/update-files.js | 12 +- script/sync-algolia-search-indices.js | 1 - tests/browser/browser.js | 11 +- tests/content/category-pages.js | 1 - tests/content/featured-links.js | 43 +- tests/content/graphql.js | 12 +- tests/content/lint-files.js | 75 +- tests/content/site-data-references.js | 1 - tests/content/site-data.js | 1 - tests/content/site-tree.js | 69 +- tests/content/webhooks.js | 22 +- .../article-with-mislocalized-frontmatter.md | 7 +- tests/fixtures/developer-redirects.json | 110 +-- tests/fixtures/graphql-redirects.json | 720 ++++++++-------- .../article-with-mislocalized-frontmatter.md | 9 - .../new-versions/developer-redirects.json | 68 -- .../new-versions/graphql-redirects.json | 446 ---------- ...that-does-not-exist-in-translations-dir.md | 6 - .../page-with-frontmatter-error.md | 6 - .../new-versions/page-with-redirects.md | 8 - .../actions/some-category/some-article.md | 6 - .../github/some-category/some-article.md | 6 - .../fixtures/new-versions/rest-redirects.json | 506 ----------- tests/fixtures/new-versions/sample-article.md | 6 - .../fixtures/new-versions/sample-toc-index.md | 7 - .../translated-toc-with-no-links-index.md | 9 - ...that-does-not-exist-in-translations-dir.md | 5 +- tests/fixtures/page-with-frontmatter-error.md | 4 +- tests/fixtures/page-with-redirects.md | 5 +- .../actions/some-category/some-article.md | 5 +- .../admin/some-category/some-article.md | 0 .../enterprise/some-category/some-article.md | 5 - .../github/some-category/some-article.md | 5 +- .../remove-liquid-statements/frontmatter1.md | 2 +- .../remove-liquid-statements/frontmatter2.md | 2 +- tests/fixtures/rest-redirects.json | 816 +++++++++--------- tests/fixtures/sample-article.md | 5 +- tests/fixtures/sample-toc-index.md | 4 +- .../translated-toc-with-no-links-index.md | 4 +- .../developer-links-and-images.js | 9 +- tests/links-and-images/links-and-images.js | 5 +- tests/rendering/breadcrumbs.js | 138 +-- tests/rendering/header.js | 45 +- tests/rendering/octicon.js | 1 - tests/rendering/page-titles.js | 32 +- tests/rendering/robots-txt.js | 1 - tests/rendering/server.js | 278 +----- tests/rendering/sidebar.js | 20 +- tests/routing/developer-site-redirects.js | 348 +++----- tests/routing/redirects.js | 80 +- tests/unit/find-page.js | 47 +- tests/unit/liquid-helpers.js | 32 +- tests/unit/liquid.js | 1 - tests/unit/page.js | 319 +------ tests/unit/pages.js | 1 - tests/unit/permalink.js | 49 +- tests/unit/products.js | 33 +- tests/unit/toc-links.js | 6 +- tests/unit/versions.js | 7 +- 95 files changed, 1342 insertions(+), 3974 deletions(-) delete mode 100644 tests/fixtures/new-versions/article-with-mislocalized-frontmatter.md delete mode 100644 tests/fixtures/new-versions/developer-redirects.json delete mode 100644 tests/fixtures/new-versions/graphql-redirects.json delete mode 100644 tests/fixtures/new-versions/page-that-does-not-exist-in-translations-dir.md delete mode 100644 tests/fixtures/new-versions/page-with-frontmatter-error.md delete mode 100644 tests/fixtures/new-versions/page-with-redirects.md delete mode 100644 tests/fixtures/new-versions/products/actions/some-category/some-article.md delete mode 100644 tests/fixtures/new-versions/products/github/some-category/some-article.md delete mode 100644 tests/fixtures/new-versions/rest-redirects.json delete mode 100644 tests/fixtures/new-versions/sample-article.md delete mode 100644 tests/fixtures/new-versions/sample-toc-index.md delete mode 100644 tests/fixtures/new-versions/translated-toc-with-no-links-index.md rename tests/fixtures/{new-versions => }/products/admin/some-category/some-article.md (100%) delete mode 100644 tests/fixtures/products/enterprise/some-category/some-article.md diff --git a/feature-flags.json b/feature-flags.json index 3bb2f19b5324..64c69f19d789 100644 --- a/feature-flags.json +++ b/feature-flags.json @@ -1,5 +1,4 @@ { "FEATURE_TEST_TRUE": true, - "FEATURE_TEST_FALSE": false, - "FEATURE_NEW_VERSIONS": true + "FEATURE_TEST_FALSE": false } diff --git a/includes/article-version-switcher.html b/includes/article-version-switcher.html index d93b17a39958..af2f6ee005b8 100644 --- a/includes/article-version-switcher.html +++ b/includes/article-version-switcher.html @@ -2,11 +2,7 @@
- {% if process.env.FEATURE_NEW_VERSIONS %} {{ site.data.ui.pages.article_version }} {{ allVersions[currentVersion].versionTitle }} - {% else %} - {{ site.data.ui.pages.article_version }} {{ productNames[currentVersion] }} - {% endif %} @@ -16,11 +12,7 @@ href="{{ permalink.href }}" class="d-block py-2 {% if currentPath == permalink.href %}link-blue active{% else %}link-gray-dark no-underline{% endif %}" > - {% if process.env.FEATURE_NEW_VERSIONS %} {{ allVersions[permalink.pageVersion].versionTitle }} - {% else %} - {{ productNames[permalink.pageVersion] }} - {% endif %} {% endfor %}
diff --git a/includes/deprecation-banner.html b/includes/deprecation-banner.html index e5ac8bdf83a9..a07c61724fc1 100644 --- a/includes/deprecation-banner.html +++ b/includes/deprecation-banner.html @@ -1,6 +1,3 @@ -{% unless process.env.FEATURE_NEW_VERSIONS %} -{% assign enterpriseServerReleases = enterpriseVersions %} -{% endunless %} {% if currentVersion contains enterpriseServerReleases.oldestSupported %}

diff --git a/includes/header.html b/includes/header.html index 88a6f85bc11c..b8d134485135 100644 --- a/includes/header.html +++ b/includes/header.html @@ -44,11 +44,7 @@

{{ site.data.ui.homepag
- {% if process.env.FEATURE_NEW_VERSIONS %} {{ allProducts[currentProduct].name }} - {% else %} - {{ currentProduct.name }} - {% endif %}
@@ -57,7 +53,7 @@

{{ site.data.ui.homepag {% for product in activeProducts %} + {% if product.id == currentProduct %}text-blue-mktg text-underline active{% elsif product.id == currentProduct.id %}text-blue-mktg text-underline active{% else %}link-gray-dark no-underline{% endif %}"> {{ product.name }} {% if product.external %} @@ -68,10 +64,8 @@

{{ site.data.ui.homepag

- {% if process.env.FEATURE_NEW_VERSIONS %} {% include homepage-version-switcher %} - {% endif %}
diff --git a/includes/landing.html b/includes/landing.html index 6dd6015f10aa..a677844d816c 100644 --- a/includes/landing.html +++ b/includes/landing.html @@ -20,12 +20,7 @@

{{ site.data.ui.search.need_help }}

{{ site.data.ui.homepage.explore_by_product }}

{% for product in activeProducts %} - {% if process.env.FEATURE_NEW_VERSIONS %} - {% assign productVersions = product.versions %} - {% else %} - {% assign productVersions = currentVersion %} - {% endif %} - {% if productVersions contains currentVersion or currentVersion == 'homepage' %} + {% if product.versions contains currentVersion or currentVersion == 'homepage' %}
{{ product.name }} {% if product.external %} diff --git a/includes/sidebar-homepage.html b/includes/sidebar-homepage.html index c11a0c075ead..a6e71a5b842f 100644 --- a/includes/sidebar-homepage.html +++ b/includes/sidebar-homepage.html @@ -1,25 +1,12 @@ -{% if process.env.FEATURE_NEW_VERSIONS %} {% include all-products-link %} -{% endif %} {% for product in activeProducts %} - -{% if process.env.FEATURE_NEW_VERSIONS %} -{% assign productVersions = product.versions %} -{% else %} -{% assign productVersions = currentVersion %} -{% endif %} - -{% if productVersions contains currentVersion or currentVersion == 'homepage' %} +{% if product.versions contains currentVersion or currentVersion == 'homepage' %}