From 8e8be5d1710f246bbb43c6c0bae82dead1139fde Mon Sep 17 00:00:00 2001 From: "Luke \"Jared\" Bennett" Date: Fri, 28 Apr 2017 13:51:45 +0100 Subject: [PATCH] Fixed view to correct property --- app/helpers/sentry_helper.rb | 6 ----- .../application_settings/_form.html.haml | 4 ++-- app/views/layouts/_head.html.haml | 2 +- lib/gitlab/gon_helper.rb | 2 +- spec/helpers/sentry_helper_spec.rb | 22 ------------------- 5 files changed, 4 insertions(+), 32 deletions(-) delete mode 100644 spec/helpers/sentry_helper_spec.rb diff --git a/app/helpers/sentry_helper.rb b/app/helpers/sentry_helper.rb index 8e80f83ae61..3d255df66a0 100644 --- a/app/helpers/sentry_helper.rb +++ b/app/helpers/sentry_helper.rb @@ -6,10 +6,4 @@ module SentryHelper def sentry_context Gitlab::Sentry.context(current_user) end - - def clientside_sentry_enabled? - current_application_settings.clientside_sentry_enabled - end - - delegate :clientside_sentry_dsn, to: :current_application_settings end diff --git a/app/views/admin/application_settings/_form.html.haml b/app/views/admin/application_settings/_form.html.haml index 5cc99e0833f..6030c8b1dfa 100644 --- a/app/views/admin/application_settings/_form.html.haml +++ b/app/views/admin/application_settings/_form.html.haml @@ -422,9 +422,9 @@ %a{ href: 'https://sentry.io/for/javascript/', target: '_blank', rel: 'noopener noreferrer' } https://sentry.io/for/javascript/ .form-group - = f.label :sentry_dsn, 'Sentry DSN', class: 'control-label col-sm-2' + = f.label :clientside_sentry_dsn, 'Clientside Sentry DSN', class: 'control-label col-sm-2' .col-sm-10 - = f.text_field :sentry_dsn, class: 'form-control' + = f.text_field :clientside_sentry_dsn, class: 'form-control' %fieldset %legend Repository Storage diff --git a/app/views/layouts/_head.html.haml b/app/views/layouts/_head.html.haml index 1579afa6461..b768ac5a36c 100644 --- a/app/views/layouts/_head.html.haml +++ b/app/views/layouts/_head.html.haml @@ -33,7 +33,7 @@ = webpack_bundle_tag "runtime" = webpack_bundle_tag "common" = webpack_bundle_tag "main" - = webpack_bundle_tag "raven" if clientside_sentry_enabled? + = webpack_bundle_tag "raven" if Gitlab.config.clientside_sentry_enabled - if content_for?(:page_specific_javascripts) = yield :page_specific_javascripts diff --git a/lib/gitlab/gon_helper.rb b/lib/gitlab/gon_helper.rb index a8a2715e848..e7ae1d16698 100644 --- a/lib/gitlab/gon_helper.rb +++ b/lib/gitlab/gon_helper.rb @@ -12,7 +12,7 @@ module Gitlab gon.user_color_scheme = Gitlab::ColorSchemes.for_user(current_user).css_class gon.katex_css_url = ActionController::Base.helpers.asset_path('katex.css') gon.katex_js_url = ActionController::Base.helpers.asset_path('katex.js') - gon.sentry_dsn = Gitlab.config.clientside_sentry_dsn if clientside_sentry_enabled? + gon.sentry_dsn = Gitlab.config.clientside_sentry_dsn if Gitlab.config.clientside_sentry_enabled gon.gitlab_url = Gitlab.config.gitlab.url gon.is_production = Rails.env.production? diff --git a/spec/helpers/sentry_helper_spec.rb b/spec/helpers/sentry_helper_spec.rb deleted file mode 100644 index ff218235cd1..00000000000 --- a/spec/helpers/sentry_helper_spec.rb +++ /dev/null @@ -1,22 +0,0 @@ -require 'spec_helper' - -describe SentryHelper do - describe '#sentry_dsn_public' do - it 'returns nil if no sentry_dsn is set' do - mock_sentry_dsn(nil) - - expect(helper.sentry_dsn_public).to eq nil - end - - it 'returns the uri string with no password if sentry_dsn is set' do - mock_sentry_dsn('https://test:dsn@host/path') - - expect(helper.sentry_dsn_public).to eq 'https://test@host/path' - end - end - - def mock_sentry_dsn(value) - allow_message_expectations_on_nil - allow(ApplicationSetting.current).to receive(:sentry_dsn).and_return(value) - end -end -- GitLab