summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-07-07 00:08:58 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-07-07 00:08:58 +0000
commit7dc324669696d50d39cdf62e824f492375f7f5dd (patch)
tree86c69f126dd74a7a87227c0fb726b372d41da05b /app
parent8bba6175aa3311f1d7f2901659722b79218395d7 (diff)
downloadgitlab-ce-7dc324669696d50d39cdf62e824f492375f7f5dd.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue12
-rw-r--r--app/assets/javascripts/vue_merge_request_widget/components/states/squash_before_merge.vue2
-rw-r--r--app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js3
-rw-r--r--app/controllers/projects/pipelines_controller.rb17
4 files changed, 23 insertions, 11 deletions
diff --git a/app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue b/app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue
index 82be5eeb5ff..56cfd441fbc 100644
--- a/app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue
+++ b/app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue
@@ -45,7 +45,8 @@ export default {
isMakingRequest: false,
isMergingImmediately: false,
commitMessage: this.mr.commitMessage,
- squashBeforeMerge: this.mr.squash,
+ squashBeforeMerge: this.mr.squashIsSelected,
+ isSquashReadOnly: this.mr.squashIsReadonly,
successSvg,
warningSvg,
squashCommitMessage: this.mr.squashCommitMessage,
@@ -106,7 +107,12 @@ export default {
return this.isMergeButtonDisabled;
},
shouldShowSquashBeforeMerge() {
- const { commitsCount, enableSquashBeforeMerge } = this.mr;
+ const { commitsCount, enableSquashBeforeMerge, squashIsReadonly, squashIsSelected } = this.mr;
+
+ if (squashIsReadonly && !squashIsSelected) {
+ return false;
+ }
+
return enableSquashBeforeMerge && commitsCount > 1;
},
shouldShowMergeControls() {
@@ -344,7 +350,7 @@ export default {
v-if="shouldShowSquashBeforeMerge"
v-model="squashBeforeMerge"
:help-path="mr.squashBeforeMergeHelpPath"
- :is-disabled="isMergeButtonDisabled"
+ :is-disabled="isSquashReadOnly"
/>
</template>
<template v-else>
diff --git a/app/assets/javascripts/vue_merge_request_widget/components/states/squash_before_merge.vue b/app/assets/javascripts/vue_merge_request_widget/components/states/squash_before_merge.vue
index 5305894873f..14e0a9e18a3 100644
--- a/app/assets/javascripts/vue_merge_request_widget/components/states/squash_before_merge.vue
+++ b/app/assets/javascripts/vue_merge_request_widget/components/states/squash_before_merge.vue
@@ -30,7 +30,7 @@ export default {
<template>
<div class="inline">
- <label>
+ <label :class="{ 'gl-text-gray-600': isDisabled }" data-testid="squashLabel">
<input
:checked="value"
:disabled="isDisabled"
diff --git a/app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js b/app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js
index d61e122d612..8bba40a593d 100644
--- a/app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js
+++ b/app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js
@@ -22,7 +22,10 @@ export default class MergeRequestStore {
const pipelineStatus = data.pipeline ? data.pipeline.details.status : null;
this.squash = data.squash;
+ this.squashIsEnabledByDefault = data.squash_enabled_by_default;
+ this.squashIsReadonly = data.squash_readonly;
this.enableSquashBeforeMerge = this.enableSquashBeforeMerge || true;
+ this.squashIsSelected = data.squash_readonly ? data.squash_on_merge : data.squash;
this.iid = data.iid;
this.title = data.title;
diff --git a/app/controllers/projects/pipelines_controller.rb b/app/controllers/projects/pipelines_controller.rb
index f27ac8b53e4..c5877012ea8 100644
--- a/app/controllers/projects/pipelines_controller.rb
+++ b/app/controllers/projects/pipelines_controller.rb
@@ -19,6 +19,9 @@ class Projects::PipelinesController < Projects::ApplicationController
end
before_action :ensure_pipeline, only: [:show]
+ # Will be removed with https://gitlab.com/gitlab-org/gitlab/-/issues/225596
+ before_action :redirect_for_legacy_scope_filter, only: [:index], if: -> { request.format.html? }
+
around_action :allow_gitaly_ref_name_caching, only: [:index, :show]
track_unique_visits :charts, target_id: 'p_analytics_pipelines'
@@ -34,9 +37,6 @@ class Projects::PipelinesController < Projects::ApplicationController
.page(params[:page])
.per(30)
- @running_count = limited_pipelines_count(project, 'running')
- @pending_count = limited_pipelines_count(project, 'pending')
- @finished_count = limited_pipelines_count(project, 'finished')
@pipelines_count = limited_pipelines_count(project)
respond_to do |format|
@@ -47,10 +47,7 @@ class Projects::PipelinesController < Projects::ApplicationController
render json: {
pipelines: serialize_pipelines,
count: {
- all: @pipelines_count,
- running: @running_count,
- pending: @pending_count,
- finished: @finished_count
+ all: @pipelines_count
}
}
end
@@ -229,6 +226,12 @@ class Projects::PipelinesController < Projects::ApplicationController
render_404 unless pipeline
end
+ def redirect_for_legacy_scope_filter
+ return unless %w[running pending].include?(params[:scope])
+
+ redirect_to url_for(safe_params.except(:scope).merge(status: safe_params[:scope])), status: :moved_permanently
+ end
+
# rubocop: disable CodeReuse/ActiveRecord
def pipeline
@pipeline ||= if params[:id].blank? && params[:latest]