diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/filtered_search/add_extra_tokens_for_merge_requests.js | 8 | ||||
-rw-r--r-- | app/controllers/dashboard_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/groups_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/projects/merge_requests_controller.rb | 4 | ||||
-rw-r--r-- | app/finders/merge_requests_finder.rb | 2 | ||||
-rw-r--r-- | app/graphql/resolvers/merge_requests_resolver.rb | 5 | ||||
-rw-r--r-- | app/views/shared/issuable/_search_bar.html.haml | 17 |
7 files changed, 31 insertions, 13 deletions
diff --git a/app/assets/javascripts/filtered_search/add_extra_tokens_for_merge_requests.js b/app/assets/javascripts/filtered_search/add_extra_tokens_for_merge_requests.js index 50fca995c81..4d3647cdf5c 100644 --- a/app/assets/javascripts/filtered_search/add_extra_tokens_for_merge_requests.js +++ b/app/assets/javascripts/filtered_search/add_extra_tokens_for_merge_requests.js @@ -101,8 +101,10 @@ export default (IssuableTokenKeys, disableTargetBranchFilter = false) => { ], }; - IssuableTokenKeys.tokenKeys.splice(3, 0, approvedToken.token); - IssuableTokenKeys.conditions.push(...approvedToken.conditions); + if (gon.features.mrApprovedFilter) { + IssuableTokenKeys.tokenKeys.splice(3, 0, approvedToken.token); + IssuableTokenKeys.conditions.push(...approvedToken.conditions); + } const approvedBy = { token: { @@ -149,7 +151,7 @@ export default (IssuableTokenKeys, disableTargetBranchFilter = false) => { ], }; - const tokenPosition = 4; + const tokenPosition = gon.features.mrApprovedFilter ? 4 : 3; IssuableTokenKeys.tokenKeys.splice(tokenPosition, 0, approvedBy.token); IssuableTokenKeys.tokenKeysWithAlternative.splice( tokenPosition, diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index b003ca564f3..d70b2e57a95 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -12,6 +12,10 @@ class DashboardController < Dashboard::ApplicationController before_action :set_show_full_reference, only: [:issues, :merge_requests] before_action :check_filters_presence!, only: [:issues, :merge_requests] + before_action only: :merge_requests do + push_frontend_feature_flag(:mr_approved_filter, type: :ops) + end + respond_to :html feature_category :user_profile, [:activity] diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index b7578bcf465..d2f65104d86 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -38,6 +38,10 @@ class GroupsController < Groups::ApplicationController push_force_frontend_feature_flag(:work_items, group.work_items_feature_flag_enabled?) end + before_action only: :merge_requests do + push_frontend_feature_flag(:mr_approved_filter, type: :ops) + end + helper_method :captcha_required? skip_cross_project_access_check :index, :new, :create, :edit, :update, :destroy, :projects diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb index ef944dad6e9..a5d3bc4ac4a 100644 --- a/app/controllers/projects/merge_requests_controller.rb +++ b/app/controllers/projects/merge_requests_controller.rb @@ -32,6 +32,10 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo before_action :authenticate_user!, only: [:assign_related_issues] before_action :check_user_can_push_to_source_branch!, only: [:rebase] + before_action only: :index do + push_frontend_feature_flag(:mr_approved_filter, type: :ops) + end + before_action only: [:show, :diffs] do push_frontend_feature_flag(:content_editor_on_issues, project&.group) push_force_frontend_feature_flag(:content_editor_on_issues, project&.content_editor_on_issues_feature_flag_enabled?) diff --git a/app/finders/merge_requests_finder.rb b/app/finders/merge_requests_finder.rb index 0ce2d52f168..f1c5d5e08ad 100644 --- a/app/finders/merge_requests_finder.rb +++ b/app/finders/merge_requests_finder.rb @@ -187,7 +187,7 @@ class MergeRequestsFinder < IssuableFinder def by_approved(items) approved_param = Gitlab::Utils.to_boolean(params.fetch(:approved, nil)) - return items if approved_param.nil? + return items if approved_param.nil? || Feature.disabled?(:mr_approved_filter, type: :ops) if approved_param items.with_approvals diff --git a/app/graphql/resolvers/merge_requests_resolver.rb b/app/graphql/resolvers/merge_requests_resolver.rb index c725f165682..0cdff272ee5 100644 --- a/app/graphql/resolvers/merge_requests_resolver.rb +++ b/app/graphql/resolvers/merge_requests_resolver.rb @@ -57,7 +57,10 @@ module Resolvers argument :approved, GraphQL::Types::Boolean, required: false, - description: 'Limit results to approved merge requests.' + description: <<~DESC + Limit results to approved merge requests. + Available only when the feature flag `mr_approved_filter` is enabled. + DESC argument :created_after, Types::TimeType, required: false, diff --git a/app/views/shared/issuable/_search_bar.html.haml b/app/views/shared/issuable/_search_bar.html.haml index 06bc0ff5173..76678c48a86 100644 --- a/app/views/shared/issuable/_search_bar.html.haml +++ b/app/views/shared/issuable/_search_bar.html.haml @@ -162,14 +162,15 @@ %li.filter-dropdown-item{ data: { value: 'no', capitalize: true } } %button.gl-button.btn.btn-link{ type: 'button' } = _('No') - #js-dropdown-approved.filtered-search-input-dropdown-menu.dropdown-menu - %ul.filter-dropdown{ data: { dropdown: true } } - %li.filter-dropdown-item{ data: { value: 'yes', capitalize: true } } - %button.gl-button.btn.btn-link{ type: 'button' } - = _('Yes') - %li.filter-dropdown-item{ data: { value: 'no', capitalize: true } } - %button.gl-button.btn.btn-link{ type: 'button' } - = _('No') + - if ::Feature.enabled?(:mr_approved_filter, type: :ops) + #js-dropdown-approved.filtered-search-input-dropdown-menu.dropdown-menu + %ul.filter-dropdown{ data: { dropdown: true } } + %li.filter-dropdown-item{ data: { value: 'yes', capitalize: true } } + %button.gl-button.btn.btn-link{ type: 'button' } + = _('Yes') + %li.filter-dropdown-item{ data: { value: 'no', capitalize: true } } + %button.gl-button.btn.btn-link{ type: 'button' } + = _('No') #js-dropdown-confidential.filtered-search-input-dropdown-menu.dropdown-menu %ul.filter-dropdown{ data: { dropdown: true } } %li.filter-dropdown-item{ data: { value: 'yes', capitalize: true } } |