Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2021-03-18 21:09:00 +00:00
parent c8deb6a801
commit 7d46e0437f
13 changed files with 31 additions and 26 deletions

View file

@ -184,21 +184,6 @@ Lint/MixedRegexpCaptureTypes:
Lint/RedundantCopDisableDirective:
Enabled: false
# Offense count: 9
# Cop supports --auto-correct.
# Configuration parameters: AllowedMethods.
# AllowedMethods: instance_of?, kind_of?, is_a?, eql?, respond_to?, equal?
Lint/RedundantSafeNavigation:
Exclude:
- 'app/controllers/concerns/labels_as_hash.rb'
- 'app/policies/note_policy.rb'
- 'app/services/users/update_canonical_email_service.rb'
- 'ee/app/presenters/iteration_presenter.rb'
- 'ee/app/services/ee/members/destroy_service.rb'
- 'ee/lib/ee/gitlab/email/handler/reply_processing.rb'
- 'qa/qa/specs/helpers/quarantine.rb'
- 'spec/controllers/boards/issues_controller_spec.rb'
# Offense count: 1
Lint/SelfAssignment:
Exclude:

View file

@ -11,7 +11,7 @@ module LabelsAsHash
label_hashes = available_labels.as_json(only: [:title, :color])
if target&.respond_to?(:labels)
if target.respond_to?(:labels)
already_set_labels = available_labels & target.labels
if already_set_labels.present?
titles = already_set_labels.map(&:title)

View file

@ -76,7 +76,7 @@ class NotePolicy < BasePolicy
def parent_namespace
strong_memoize(:parent_namespace) do
next if @subject.is_a?(PersonalSnippet)
next @subject.noteable.group if @subject.noteable&.is_a?(Epic)
next @subject.noteable.group if @subject.noteable.is_a?(Epic)
@subject.project
end

View file

@ -7,7 +7,7 @@ module Users
INCLUDED_DOMAINS_PATTERN = [/gmail.com/].freeze
def initialize(user:)
raise ArgumentError.new("Please provide a user") unless user&.is_a?(User)
raise ArgumentError.new("Please provide a user") unless user.is_a?(User)
@user = user
end

View file

@ -16,7 +16,7 @@
= link_to toggle_group_runners_project_runners_path(@project), class: 'btn gl-button btn-warning-secondary', method: :post do
= _('Disable group runners')
- else
= link_to toggle_group_runners_project_runners_path(@project), class: 'btn gl-button btn-success btn-inverted', method: :post do
= link_to toggle_group_runners_project_runners_path(@project), class: 'btn gl-button btn-confirm-secondary', method: :post do
= _('Enable group runners')
&nbsp;
= _('for this project')

View file

@ -21,7 +21,7 @@
- if runner.active?
= link_to _('Pause'), pause_project_runner_path(@project, runner), method: :post, class: 'btn gl-button btn-sm btn-danger', data: { confirm: _("Are you sure?") }
- else
= link_to _('Resume'), resume_project_runner_path(@project, runner), method: :post, class: 'btn gl-button btn-success btn-sm'
= link_to _('Resume'), resume_project_runner_path(@project, runner), method: :post, class: 'btn gl-button btn-confirm btn-sm'
- if runner.belongs_to_one_project?
= link_to _('Remove runner'), project_runner_path(@project, runner), data: { confirm: _("Are you sure?") }, method: :delete, class: 'btn gl-button btn-danger btn-sm'
- else

View file

@ -12,7 +12,7 @@
= link_to toggle_shared_runners_project_runners_path(@project), class: 'btn gl-button btn-warning-secondary', method: :post do
= _('Disable shared runners')
- else
= link_to toggle_shared_runners_project_runners_path(@project), class: 'btn gl-button btn-success', method: :post do
= link_to toggle_shared_runners_project_runners_path(@project), class: 'btn gl-button btn-confirm', method: :post do
= _('Enable shared runners')
&nbsp; for this project

View file

@ -0,0 +1,5 @@
---
title: Move from btn-success to btn-confirm in runners directory
merge_request: 56485
author: Yogi (@yo)
type: changed

View file

@ -0,0 +1,5 @@
---
title: Fixes offense Lint/RedundantSafeNavigation
merge_request: 56884
author: Shubham Kumar (@imskr)
type: fixed

View file

@ -55,14 +55,14 @@ module Gitlab
# scope :created_at_ordered, -> {
# keyset_order = Gitlab::Pagination::Keyset::Order.build([
# Gitlab::Pagination::Keyset::ColumnOrderDefinition.new(
# attribute: :created_at,
# attribute_name: :created_at,
# column_expression: Project.arel_table[:created_at],
# order_expression: Project.arel_table[:created_at].asc,
# distinct: false, # values in the column are not unique
# nullable: :nulls_last # we might see NULL values (bottom)
# ),
# Gitlab::Pagination::Keyset::ColumnOrderDefinition.new(
# attribute: :id,
# attribute_name: :id,
# order_expression: Project.arel_table[:id].asc
# )
# ])

View file

@ -52,7 +52,7 @@ module QA
if example.metadata.key?(:quarantine)
quarantine_tag = example.metadata[:quarantine]
if quarantine_tag&.is_a?(Hash) && quarantine_tag&.key?(:only)
if quarantine_tag.is_a?(Hash) && quarantine_tag&.key?(:only)
# If the :quarantine hash contains :only, we respect that.
# For instance `quarantine: { only: { subdomain: :staging } }` will only quarantine the test when it runs against staging.
return unless Runtime::Env.context_matches?(quarantine_tag[:only])

View file

@ -404,7 +404,7 @@ RSpec.describe Boards::IssuesController do
list_id: list.try(:to_param)
}
unless board.try(:parent)&.is_a?(Group)
unless board.try(:parent).is_a?(Group)
params[:namespace_id] = project.namespace.to_param
params[:project_id] = project
end

View file

@ -44,7 +44,7 @@
# end
# end
#
RSpec.shared_examples 'sorted paginated query' do
RSpec.shared_examples 'sorted paginated query' do |conditions = {}|
# Provided as a convenience when constructing queries using string concatenation
let(:page_info) { 'pageInfo { startCursor endCursor }' }
# Convenience for using default implementation of pagination_results_data
@ -123,6 +123,16 @@ RSpec.shared_examples 'sorted paginated query' do
expect(results).to eq first_page
end
end
context 'when last and sort params are present', if: conditions[:is_reversible] do
let(:params) { sort_argument.merge(last: 1) }
it 'fetches last elements without error' do
post_graphql(pagination_query(params), current_user: current_user)
expect(results.first).to eq(expected_results.last)
end
end
end
end
end