Commit 35c2d695 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'ce-to-ee-2018-11-12' into 'master'

CE upstream - 2018-11-12 18:21 UTC

Closes gitlab-ce#53853

See merge request gitlab-org/gitlab-ee!8408
parents 8809a09b 2107e6a7
...@@ -40,10 +40,8 @@ export default { ...@@ -40,10 +40,8 @@ export default {
failed: __('Failed to deploy to'), failed: __('Failed to deploy to'),
}, },
data() { data() {
const features = window.gon.features || {};
return { return {
isStopping: false, isStopping: false,
enableCiEnvironmentsStatusChanges: features.ciEnvironmentsStatusChanges,
}; };
}, },
computed: { computed: {
...@@ -74,10 +72,7 @@ export default { ...@@ -74,10 +72,7 @@ export default {
: ''; : '';
}, },
shouldRenderDropdown() { shouldRenderDropdown() {
return ( return this.deployment.changes && this.deployment.changes.length > 0;
this.enableCiEnvironmentsStatusChanges &&
(this.deployment.changes && this.deployment.changes.length > 0)
);
}, },
}, },
methods: { methods: {
......
...@@ -16,9 +16,6 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo ...@@ -16,9 +16,6 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
before_action :set_issuables_index, only: [:index] before_action :set_issuables_index, only: [:index]
before_action :authenticate_user!, only: [:assign_related_issues] before_action :authenticate_user!, only: [:assign_related_issues]
before_action :check_user_can_push_to_source_branch!, only: [:rebase] before_action :check_user_can_push_to_source_branch!, only: [:rebase]
before_action do
push_frontend_feature_flag(:ci_environments_status_changes)
end
def index def index
@merge_requests = @issuables @merge_requests = @issuables
......
...@@ -142,7 +142,7 @@ class MergeRequestDiff < ActiveRecord::Base ...@@ -142,7 +142,7 @@ class MergeRequestDiff < ActiveRecord::Base
end end
def commits_by_shas(shas) def commits_by_shas(shas)
return [] unless shas.present? return MergeRequestDiffCommit.none unless shas.present?
merge_request_diff_commits.where(sha: shas) merge_request_diff_commits.where(sha: shas)
end end
......
...@@ -37,7 +37,7 @@ class EnvironmentStatusEntity < Grape::Entity ...@@ -37,7 +37,7 @@ class EnvironmentStatusEntity < Grape::Entity
es.deployment.try(:formatted_deployment_time) es.deployment.try(:formatted_deployment_time)
end end
expose :changes, if: ->(*) { Feature.enabled?(:ci_environments_status_changes, project) } expose :changes
private private
......
...@@ -174,57 +174,13 @@ describe('Deployment component', () => { ...@@ -174,57 +174,13 @@ describe('Deployment component', () => {
}); });
}); });
describe('with `features.ciEnvironmentsStatusChanges` enabled', () => {
beforeEach(() => {
window.gon = window.gon || {};
window.gon.features = window.gon.features || {};
window.gon.features.ciEnvironmentsStatusChanges = true;
vm = mountComponent(Component, { deployment: { ...deploymentMockData } });
});
afterEach(() => {
window.gon.features = {};
});
it('renders dropdown with changes', () => {
expect(vm.$el.querySelector('.js-mr-wigdet-deployment-dropdown')).not.toBeNull();
expect(vm.$el.querySelector('.js-deploy-url-feature-flag')).toBeNull();
});
});
describe('with `features.ciEnvironmentsStatusChanges` disabled', () => {
beforeEach(() => {
window.gon = window.gon || {};
window.gon.features = window.gon.features || {};
window.gon.features.ciEnvironmentsStatusChanges = false;
vm = mountComponent(Component, { deployment: { ...deploymentMockData } });
});
afterEach(() => {
delete window.gon.features.ciEnvironmentsStatusChanges;
});
it('renders the old link to the review app', () => {
expect(vm.$el.querySelector('.js-mr-wigdet-deployment-dropdown')).toBeNull();
expect(vm.$el.querySelector('.js-deploy-url-feature-flag')).not.toBeNull();
});
});
describe('without changes', () => { describe('without changes', () => {
beforeEach(() => { beforeEach(() => {
window.gon = window.gon || {};
window.gon.features = window.gon.features || {};
window.gon.features.ciEnvironmentsStatusChanges = true;
delete deploymentMockData.changes; delete deploymentMockData.changes;
vm = mountComponent(Component, { deployment: { ...deploymentMockData } }); vm = mountComponent(Component, { deployment: { ...deploymentMockData } });
}); });
afterEach(() => {
delete window.gon.features.ciEnvironmentsStatusChanges;
});
it('renders the link to the review app without dropdown', () => { it('renders the link to the review app without dropdown', () => {
expect(vm.$el.querySelector('.js-mr-wigdet-deployment-dropdown')).toBeNull(); expect(vm.$el.querySelector('.js-mr-wigdet-deployment-dropdown')).toBeNull();
expect(vm.$el.querySelector('.js-deploy-url-feature-flag')).not.toBeNull(); expect(vm.$el.querySelector('.js-deploy-url-feature-flag')).not.toBeNull();
......
...@@ -458,10 +458,6 @@ describe('mrWidgetOptions', () => { ...@@ -458,10 +458,6 @@ describe('mrWidgetOptions', () => {
}; };
beforeEach(done => { beforeEach(done => {
window.gon = window.gon || {};
window.gon.features = window.gon.features || {};
window.gon.features.ciEnvironmentsStatusChanges = true;
vm.mr.deployments.push( vm.mr.deployments.push(
{ {
...deploymentMockData, ...deploymentMockData,
......
...@@ -3079,6 +3079,10 @@ describe MergeRequest do ...@@ -3079,6 +3079,10 @@ describe MergeRequest do
end end
describe '#includes_any_commits?' do describe '#includes_any_commits?' do
it 'returns false' do
expect(subject.includes_any_commits?([])).to be_falsey
end
it 'returns false' do it 'returns false' do
expect(subject.includes_any_commits?([Gitlab::Git::BLANK_SHA])).to be_falsey expect(subject.includes_any_commits?([Gitlab::Git::BLANK_SHA])).to be_falsey
end end
......
...@@ -33,14 +33,6 @@ describe EnvironmentStatusEntity do ...@@ -33,14 +33,6 @@ describe EnvironmentStatusEntity do
it { is_expected.not_to include(:metrics_url) } it { is_expected.not_to include(:metrics_url) }
it { is_expected.not_to include(:metrics_monitoring_url) } it { is_expected.not_to include(:metrics_monitoring_url) }
context 'when :ci_environments_status_changes feature flag is disabled' do
before do
stub_feature_flags(ci_environments_status_changes: false)
end
it { is_expected.not_to include(:changes) }
end
context 'when the user is project maintainer' do context 'when the user is project maintainer' do
before do before do
project.add_maintainer(user) project.add_maintainer(user)
......
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