Merge branch 'tr-remove-embed-metrics-flag' into 'master'

Remove embed metrics feature flag

See merge request gitlab-org/gitlab-ce!31106
This commit is contained in:
Robert Speicher 2019-08-09 20:35:45 +00:00
commit 709c92bb2d
9 changed files with 8 additions and 65 deletions

View file

@ -18,9 +18,7 @@ $.fn.renderGFM = function renderGFM() {
highlightCurrentUser(this.find('.gfm-project_member').get());
initUserPopovers(this.find('.gfm-project_member').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;
};

View file

@ -161,7 +161,7 @@ class Projects::EnvironmentsController < Projects::ApplicationController
end
def metrics_dashboard
if Feature.enabled?(:gfm_embedded_metrics, project) && params[:embedded]
if params[:embedded]
result = dashboard_finder.find(
project,
current_user,

View file

@ -0,0 +1,5 @@
---
title: Link and embed metrics in GitLab Flavored Markdown
merge_request: 31106
author:
type: added

View file

@ -10,8 +10,6 @@ module Banzai
# the link, and insert this node after any html content
# surrounding the link.
def call
return doc unless Feature.enabled?(:gfm_embedded_metrics, context[:project])
doc.xpath(xpath_search).each do |node|
next unless element = element_to_embed(node)

View file

@ -13,8 +13,6 @@ module Banzai
# uses to identify the embedded content, removing
# only unnecessary nodes.
def call
return doc unless Feature.enabled?(:gfm_embedded_metrics, context[:project])
nodes.each do |node|
path = paths_by_node[node]
user_has_access = user_access_by_path[path]

View file

@ -38,11 +38,6 @@ module Gitlab
gon.current_user_fullname = current_user.name
gon.current_user_avatar_url = current_user.avatar_url
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
# Exposes the state of a feature flag to the frontend code.

View file

@ -613,31 +613,13 @@ describe Projects::EnvironmentsController do
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 } }
it_behaves_like 'the default dashboard'
it_behaves_like 'dashboard can be specified'
it_behaves_like 'dashboard can be embedded'
context 'when multiple dashboards is enabled and embedding metrics 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
context 'when multiple dashboards is disabled' do
before do
stub_feature_flags(environment_metrics_show_multiple_dashboards: false)
end
@ -646,19 +628,6 @@ describe Projects::EnvironmentsController do
it_behaves_like 'dashboard cannot be specified'
it_behaves_like 'dashboard can be embedded'
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
describe 'GET #search' do

View file

@ -40,16 +40,6 @@ describe Banzai::Filter::InlineMetricsFilter do
expect(doc.at_css('p').to_s).to include paragraph
expect(doc.at_css('.js-render-metrics')).to be_present
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

View file

@ -11,16 +11,6 @@ describe Banzai::Filter::InlineMetricsRedactorFilter do
let(:input) { %(<a href="#{url}">example</a>) }
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
it 'leaves regular non-metrics links unchanged' do
expect(doc.to_s).to eq input