Commit 5e6a5804 authored by Tristan Read's avatar Tristan Read Committed by Robert Speicher

Remove gfm_embed_metrics flag from BE

Removes the feature flag that controls whether
metrics dashboard urls unfurl the metrics dashboard
charts.
parent 25dd49cd
...@@ -18,9 +18,7 @@ $.fn.renderGFM = function renderGFM() { ...@@ -18,9 +18,7 @@ $.fn.renderGFM = function renderGFM() {
highlightCurrentUser(this.find('.gfm-project_member').get()); highlightCurrentUser(this.find('.gfm-project_member').get());
initUserPopovers(this.find('.gfm-project_member').get()); initUserPopovers(this.find('.gfm-project_member').get());
initMRPopovers(this.find('.gfm-merge_request').get()); initMRPopovers(this.find('.gfm-merge_request').get());
if (gon.features && gon.features.gfmEmbeddedMetrics) { renderMetrics(this.find('.js-render-metrics').get());
renderMetrics(this.find('.js-render-metrics').get());
}
return this; return this;
}; };
......
...@@ -161,7 +161,7 @@ class Projects::EnvironmentsController < Projects::ApplicationController ...@@ -161,7 +161,7 @@ class Projects::EnvironmentsController < Projects::ApplicationController
end end
def metrics_dashboard def metrics_dashboard
if Feature.enabled?(:gfm_embedded_metrics, project) && params[:embedded] if params[:embedded]
result = dashboard_finder.find( result = dashboard_finder.find(
project, project,
current_user, current_user,
......
---
title: Link and embed metrics in GitLab Flavored Markdown
merge_request: 31106
author:
type: added
...@@ -10,8 +10,6 @@ module Banzai ...@@ -10,8 +10,6 @@ module Banzai
# the link, and insert this node after any html content # the link, and insert this node after any html content
# surrounding the link. # surrounding the link.
def call def call
return doc unless Feature.enabled?(:gfm_embedded_metrics, context[:project])
doc.xpath(xpath_search).each do |node| doc.xpath(xpath_search).each do |node|
next unless element = element_to_embed(node) next unless element = element_to_embed(node)
......
...@@ -13,8 +13,6 @@ module Banzai ...@@ -13,8 +13,6 @@ module Banzai
# uses to identify the embedded content, removing # uses to identify the embedded content, removing
# only unnecessary nodes. # only unnecessary nodes.
def call def call
return doc unless Feature.enabled?(:gfm_embedded_metrics, context[:project])
nodes.each do |node| nodes.each do |node|
path = paths_by_node[node] path = paths_by_node[node]
user_has_access = user_access_by_path[path] user_has_access = user_access_by_path[path]
......
...@@ -38,11 +38,6 @@ module Gitlab ...@@ -38,11 +38,6 @@ module Gitlab
gon.current_user_fullname = current_user.name gon.current_user_fullname = current_user.name
gon.current_user_avatar_url = current_user.avatar_url gon.current_user_avatar_url = current_user.avatar_url
end end
# Flag controls a GFM feature used across many routes.
# Pushing the flag from one place simplifies control
# and facilitates easy removal.
push_frontend_feature_flag(:gfm_embedded_metrics)
end end
# Exposes the state of a feature flag to the frontend code. # Exposes the state of a feature flag to the frontend code.
......
...@@ -613,31 +613,13 @@ describe Projects::EnvironmentsController do ...@@ -613,31 +613,13 @@ describe Projects::EnvironmentsController do
end end
end end
shared_examples_for 'dashboard cannot be embedded' do
context 'when the embedded flag is included' do
let(:dashboard_params) { { format: :json, embedded: true } }
it_behaves_like 'the default dashboard'
end
end
let(:dashboard_params) { { format: :json } } let(:dashboard_params) { { format: :json } }
it_behaves_like 'the default dashboard' it_behaves_like 'the default dashboard'
it_behaves_like 'dashboard can be specified' it_behaves_like 'dashboard can be specified'
it_behaves_like 'dashboard can be embedded' it_behaves_like 'dashboard can be embedded'
context 'when multiple dashboards is enabled and embedding metrics is disabled' do context 'when multiple dashboards is disabled' do
before do
stub_feature_flags(gfm_embedded_metrics: false)
end
it_behaves_like 'the default dashboard'
it_behaves_like 'dashboard can be specified'
it_behaves_like 'dashboard cannot be embedded'
end
context 'when multiple dashboards is disabled and embedding metrics is enabled' do
before do before do
stub_feature_flags(environment_metrics_show_multiple_dashboards: false) stub_feature_flags(environment_metrics_show_multiple_dashboards: false)
end end
...@@ -646,19 +628,6 @@ describe Projects::EnvironmentsController do ...@@ -646,19 +628,6 @@ describe Projects::EnvironmentsController do
it_behaves_like 'dashboard cannot be specified' it_behaves_like 'dashboard cannot be specified'
it_behaves_like 'dashboard can be embedded' it_behaves_like 'dashboard can be embedded'
end end
context 'when multiple dashboards and embedding metrics are disabled' do
before do
stub_feature_flags(
environment_metrics_show_multiple_dashboards: false,
gfm_embedded_metrics: false
)
end
it_behaves_like 'the default dashboard'
it_behaves_like 'dashboard cannot be specified'
it_behaves_like 'dashboard cannot be embedded'
end
end end
describe 'GET #search' do describe 'GET #search' do
......
...@@ -40,16 +40,6 @@ describe Banzai::Filter::InlineMetricsFilter do ...@@ -40,16 +40,6 @@ describe Banzai::Filter::InlineMetricsFilter do
expect(doc.at_css('p').to_s).to include paragraph expect(doc.at_css('p').to_s).to include paragraph
expect(doc.at_css('.js-render-metrics')).to be_present expect(doc.at_css('.js-render-metrics')).to be_present
end end
context 'when the feature is disabled' do
before do
stub_feature_flags(gfm_embedded_metrics: false)
end
it 'does nothing' do
expect(doc.to_s).to eq input
end
end
end end
end end
end end
...@@ -11,16 +11,6 @@ describe Banzai::Filter::InlineMetricsRedactorFilter do ...@@ -11,16 +11,6 @@ describe Banzai::Filter::InlineMetricsRedactorFilter do
let(:input) { %(<a href="#{url}">example</a>) } let(:input) { %(<a href="#{url}">example</a>) }
let(:doc) { filter(input) } let(:doc) { filter(input) }
context 'when the feature is disabled' do
before do
stub_feature_flags(gfm_embedded_metrics: false)
end
it 'does nothing' do
expect(doc.to_s).to eq input
end
end
context 'without a metrics charts placeholder' do context 'without a metrics charts placeholder' do
it 'leaves regular non-metrics links unchanged' do it 'leaves regular non-metrics links unchanged' do
expect(doc.to_s).to eq input expect(doc.to_s).to eq input
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment