From 3e09a7768fed37e2cf6429251a27ea7712a7efaf Mon Sep 17 00:00:00 2001 From: Ben Halpern Date: Wed, 16 Sep 2020 13:57:05 -0400 Subject: [PATCH] [deploy] Remove need for ENV vars during asset precompile (#10349) * Remove need for ENV vars during asset precompile * Add open-search test --- app/assets/config/manifest.js | 1 - app/assets/javascripts/base.js.erb | 4 ++-- .../initializers/initializeCommentsPage.js.erb | 2 +- .../utilities/buildCommentFormHTML.js.erb | 2 +- .../javascripts/utilities/buildCommentHTML.js.erb | 2 +- app/controllers/open_search_controller.rb | 8 ++++++++ app/views/layouts/admin.html.erb | 6 +++++- .../open_search/show.xml.erb} | 0 app/views/shell/_top.html.erb | 4 +++- config/environments/production.rb | 11 ++++++++++- config/initializers/hypershield.rb | 2 +- config/routes.rb | 4 ++++ spec/requests/open_search_spec.rb | 12 ++++++++++++ 13 files changed, 48 insertions(+), 10 deletions(-) create mode 100644 app/controllers/open_search_controller.rb rename app/{assets/xml/search.xml.erb => views/open_search/show.xml.erb} (100%) create mode 100644 spec/requests/open_search_spec.rb diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js index 2efa460d5..14d3134ca 100644 --- a/app/assets/config/manifest.js +++ b/app/assets/config/manifest.js @@ -6,4 +6,3 @@ //= link administrate/application.css //= link administrate/application.js //= link katex.css -//= link search.xml diff --git a/app/assets/javascripts/base.js.erb b/app/assets/javascripts/base.js.erb index c3e21be35..a525bc8c3 100644 --- a/app/assets/javascripts/base.js.erb +++ b/app/assets/javascripts/base.js.erb @@ -685,9 +685,9 @@ var instantClick // INITIALIZE/ERROR HANDLING Honeybadger.configure({ - apiKey: "<%= ApplicationConfig['HONEYBADGER_JS_API_KEY'] %>", + apiKey: document.body.dataset.honeybadgerKey, environment: "<%= Rails.env %>", - revision: "<%= ApplicationConfig['HEROKU_SLUG_COMMIT'] %>", + revision: document.body.dataset.releaseFootprint, ignorePatterns: [/ResizeObserver/i, /MetaMask/i], }); diff --git a/app/assets/javascripts/initializers/initializeCommentsPage.js.erb b/app/assets/javascripts/initializers/initializeCommentsPage.js.erb index f05c730b3..77ca00247 100644 --- a/app/assets/javascripts/initializers/initializeCommentsPage.js.erb +++ b/app/assets/javascripts/initializers/initializeCommentsPage.js.erb @@ -159,7 +159,7 @@ function toggleCodeOfConduct() { var checkboxWrapper = document.getElementById('toggle-code-of-conduct-checkbox'); if (checkboxWrapper && !codeOfConduct) { checkboxWrapper.innerHTML = '\ - ' + ' } } diff --git a/app/assets/javascripts/utilities/buildCommentFormHTML.js.erb b/app/assets/javascripts/utilities/buildCommentFormHTML.js.erb index f5e25a91d..a3d247b58 100644 --- a/app/assets/javascripts/utilities/buildCommentFormHTML.js.erb +++ b/app/assets/javascripts/utilities/buildCommentFormHTML.js.erb @@ -5,7 +5,7 @@ function buildCommentFormHTML(commentableId, commentableType, parentId) { if (user && !user.codeOfConduct && user.commentCount < 1){ codeOfConductHTML = '
\ \ - \ + \
' } var randomIdNumber = Math.floor(Math.random() * 1991) diff --git a/app/assets/javascripts/utilities/buildCommentHTML.js.erb b/app/assets/javascripts/utilities/buildCommentHTML.js.erb index 863f3a6a7..3a4fdac0e 100644 --- a/app/assets/javascripts/utilities/buildCommentHTML.js.erb +++ b/app/assets/javascripts/utilities/buildCommentHTML.js.erb @@ -61,7 +61,7 @@ function buildCommentHTML(comment) { \ Settings\ \ - Report Abuse\ + Report Abuse\ \ \ \ diff --git a/app/controllers/open_search_controller.rb b/app/controllers/open_search_controller.rb new file mode 100644 index 000000000..7853ee5fb --- /dev/null +++ b/app/controllers/open_search_controller.rb @@ -0,0 +1,8 @@ +class OpenSearchController < ApplicationController + before_action :set_cache_control_headers, only: %i[show] + + def show + set_surrogate_key_header "open-search-xml" + render layout: false + end +end diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb index bb92de97a..777d41f1e 100644 --- a/app/views/layouts/admin.html.erb +++ b/app/views/layouts/admin.html.erb @@ -24,7 +24,11 @@ <%= stylesheet_link_tag "admin" %> - + + >