Commit 4159fcb5 authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent e2e9bc1f2548
...@@ -52,14 +52,6 @@ Layout/ClosingParenthesisIndentation: ...@@ -52,14 +52,6 @@ Layout/ClosingParenthesisIndentation:
- 'spec/support/helpers/stub_object_storage.rb' - 'spec/support/helpers/stub_object_storage.rb'
- 'spec/workers/remove_unreferenced_lfs_objects_worker_spec.rb' - 'spec/workers/remove_unreferenced_lfs_objects_worker_spec.rb'
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: leading, trailing
Layout/DotPosition:
Exclude:
- 'app/models/concerns/relative_positioning.rb'
# Offense count: 69 # Offense count: 69
# Cop supports --auto-correct. # Cop supports --auto-correct.
Layout/EmptyLinesAroundArguments: Layout/EmptyLinesAroundArguments:
...@@ -100,12 +92,6 @@ Layout/IndentFirstParameter: ...@@ -100,12 +92,6 @@ Layout/IndentFirstParameter:
- 'spec/support/helpers/repo_helpers.rb' - 'spec/support/helpers/repo_helpers.rb'
- 'spec/support/helpers/stub_object_storage.rb' - 'spec/support/helpers/stub_object_storage.rb'
# Offense count: 1
# Cop supports --auto-correct.
Layout/LeadingBlankLines:
Exclude:
- 'lib/tasks/yarn.rake'
# Offense count: 54 # Offense count: 54
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, IndentationWidth. # Configuration parameters: EnforcedStyle, IndentationWidth.
...@@ -150,11 +136,6 @@ Layout/SpaceInsideBlockBraces: ...@@ -150,11 +136,6 @@ Layout/SpaceInsideBlockBraces:
Layout/SpaceInsideParens: Layout/SpaceInsideParens:
Enabled: false Enabled: false
# Offense count: 1
Lint/DisjunctiveAssignmentInConstructor:
Exclude:
- 'app/models/uploads/base.rb'
# Offense count: 19 # Offense count: 19
Lint/DuplicateMethods: Lint/DuplicateMethods:
Exclude: Exclude:
...@@ -177,21 +158,6 @@ Lint/DuplicateMethods: ...@@ -177,21 +158,6 @@ Lint/DuplicateMethods:
Lint/MissingCopEnableDirective: Lint/MissingCopEnableDirective:
Enabled: false Enabled: false
# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: Whitelist.
# Whitelist: present?, blank?, presence, try, try!
Lint/SafeNavigationConsistency:
Exclude:
- 'lib/gitlab/gpg/commit.rb'
# Offense count: 2
# Cop supports --auto-correct.
Lint/ToJSON:
Exclude:
- 'lib/gitlab/cycle_analytics/usage_data.rb'
- 'lib/gitlab/template/base_template.rb'
# Offense count: 6 # Offense count: 6
Lint/UriEscapeUnescape: Lint/UriEscapeUnescape:
Exclude: Exclude:
...@@ -200,12 +166,6 @@ Lint/UriEscapeUnescape: ...@@ -200,12 +166,6 @@ Lint/UriEscapeUnescape:
- 'spec/lib/google_api/auth_spec.rb' - 'spec/lib/google_api/auth_spec.rb'
- 'spec/requests/api/files_spec.rb' - 'spec/requests/api/files_spec.rb'
# Offense count: 1
# Configuration parameters: CheckForMethodsWithNoSideEffects.
Lint/Void:
Exclude:
- 'lib/gitlab/git/diff_collection.rb'
# Offense count: 165 # Offense count: 165
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
...@@ -284,12 +244,6 @@ RSpec/LetBeforeExamples: ...@@ -284,12 +244,6 @@ RSpec/LetBeforeExamples:
- 'spec/rubocop/cop/migration/update_column_in_batches_spec.rb' - 'spec/rubocop/cop/migration/update_column_in_batches_spec.rb'
- 'spec/serializers/pipeline_details_entity_spec.rb' - 'spec/serializers/pipeline_details_entity_spec.rb'
# Offense count: 1
# Cop supports --auto-correct.
RSpec/MultipleSubjects:
Exclude:
- 'spec/services/merge_requests/create_from_issue_service_spec.rb'
# Offense count: 2018 # Offense count: 2018
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: Strict, EnforcedStyle, AllowedExplicitMatchers. # Configuration parameters: Strict, EnforcedStyle, AllowedExplicitMatchers.
...@@ -319,12 +273,6 @@ RSpec/ScatteredSetup: ...@@ -319,12 +273,6 @@ RSpec/ScatteredSetup:
- 'spec/requests/api/jobs_spec.rb' - 'spec/requests/api/jobs_spec.rb'
- 'spec/services/projects/create_service_spec.rb' - 'spec/services/projects/create_service_spec.rb'
# Offense count: 1
# Cop supports --auto-correct.
RSpec/SharedContext:
Exclude:
- 'spec/features/admin/admin_groups_spec.rb'
# Offense count: 4 # Offense count: 4
RSpec/VoidExpect: RSpec/VoidExpect:
Exclude: Exclude:
...@@ -348,12 +296,6 @@ Rails/ApplicationController: ...@@ -348,12 +296,6 @@ Rails/ApplicationController:
- 'spec/controllers/concerns/continue_params_spec.rb' - 'spec/controllers/concerns/continue_params_spec.rb'
- 'spec/lib/marginalia_spec.rb' - 'spec/lib/marginalia_spec.rb'
# Offense count: 1
# Cop supports --auto-correct.
Rails/ApplicationMailer:
Exclude:
- 'app/mailers/base_mailer.rb'
# Offense count: 8 # Offense count: 8
# Cop supports --auto-correct. # Cop supports --auto-correct.
Rails/BelongsTo: Rails/BelongsTo:
...@@ -414,14 +356,6 @@ Rails/LinkToBlank: ...@@ -414,14 +356,6 @@ Rails/LinkToBlank:
Rails/RakeEnvironment: Rails/RakeEnvironment:
Enabled: false Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: Include.
# Include: app/models/**/*.rb
Rails/RedundantAllowNil:
Exclude:
- 'app/models/application_setting.rb'
# Offense count: 868 # Offense count: 868
# Configuration parameters: Blacklist, Whitelist. # Configuration parameters: Blacklist, Whitelist.
# Blacklist: decrement!, decrement_counter, increment!, increment_counter, toggle!, touch, update_all, update_attribute, update_column, update_columns, update_counters # Blacklist: decrement!, decrement_counter, increment!, increment_counter, toggle!, touch, update_all, update_attribute, update_column, update_columns, update_counters
...@@ -457,12 +391,6 @@ Style/CommentedKeyword: ...@@ -457,12 +391,6 @@ Style/CommentedKeyword:
- 'lib/tasks/gitlab/backup.rake' - 'lib/tasks/gitlab/backup.rake'
- 'spec/tasks/gitlab/backup_rake_spec.rb' - 'spec/tasks/gitlab/backup_rake_spec.rb'
# Offense count: 1
# Cop supports --auto-correct.
Style/Dir:
Exclude:
- 'qa/qa.rb'
# Offense count: 6 # Offense count: 6
# Cop supports --auto-correct. # Cop supports --auto-correct.
Style/EachWithObject: Style/EachWithObject:
...@@ -591,13 +519,6 @@ Style/NumericLiteralPrefix: ...@@ -591,13 +519,6 @@ Style/NumericLiteralPrefix:
Style/NumericPredicate: Style/NumericPredicate:
Enabled: false Enabled: false
# Offense count: 2
# Cop supports --auto-correct.
Style/OrAssignment:
Exclude:
- 'lib/api/commit_statuses.rb'
- 'lib/gitlab/project_transfer.rb'
# Offense count: 106 # Offense count: 106
# Cop supports --auto-correct. # Cop supports --auto-correct.
Style/ParallelAssignment: Style/ParallelAssignment:
...@@ -632,12 +553,6 @@ Style/PerlBackrefs: ...@@ -632,12 +553,6 @@ Style/PerlBackrefs:
Style/RaiseArgs: Style/RaiseArgs:
Enabled: false Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
Style/RedundantConditional:
Exclude:
- 'lib/system_check/helpers.rb'
# Offense count: 221 # Offense count: 221
# Cop supports --auto-correct. # Cop supports --auto-correct.
Style/RedundantFreeze: Style/RedundantFreeze:
...@@ -704,12 +619,6 @@ Style/SingleLineMethods: ...@@ -704,12 +619,6 @@ Style/SingleLineMethods:
Style/SpecialGlobalVars: Style/SpecialGlobalVars:
EnforcedStyle: use_perl_names EnforcedStyle: use_perl_names
# Offense count: 1
# Cop supports --auto-correct.
Style/StderrPuts:
Exclude:
- 'config/initializers/rspec_profiling.rb'
# Offense count: 75 # Offense count: 75
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle. # Configuration parameters: EnforcedStyle.
...@@ -736,30 +645,6 @@ Style/TernaryParentheses: ...@@ -736,30 +645,6 @@ Style/TernaryParentheses:
- 'spec/requests/api/pipeline_schedules_spec.rb' - 'spec/requests/api/pipeline_schedules_spec.rb'
- 'spec/support/capybara.rb' - 'spec/support/capybara.rb'
# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyleForMultiline.
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
Style/TrailingCommaInArrayLiteral:
Exclude:
- 'ee/spec/models/project_spec.rb'
- 'spec/lib/gitlab/metrics/dashboard/processor_spec.rb'
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyleForMultiline.
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
Style/TrailingCommaInHashLiteral:
Exclude:
- 'lib/gitlab/ci/ansi2html.rb'
# Offense count: 2
# Cop supports --auto-correct.
Style/UnlessElse:
Exclude:
- 'lib/backup/manager.rb'
- 'lib/gitlab/project_search_results.rb'
# Offense count: 8 # Offense count: 8
# Cop supports --auto-correct. # Cop supports --auto-correct.
Style/UnneededCondition: Style/UnneededCondition:
...@@ -776,13 +661,6 @@ Style/UnneededCondition: ...@@ -776,13 +661,6 @@ Style/UnneededCondition:
Style/UnneededInterpolation: Style/UnneededInterpolation:
Enabled: false Enabled: false
# Offense count: 2
# Cop supports --auto-correct.
Style/UnneededSort:
Exclude:
- 'app/models/concerns/resolvable_discussion.rb'
- 'lib/gitlab/highlight.rb'
RSpec/ReceiveCounts: RSpec/ReceiveCounts:
Exclude: Exclude:
- 'ee/spec/models/broadcast_message_spec.rb' - 'ee/spec/models/broadcast_message_spec.rb'
...@@ -907,4 +785,4 @@ RSpec/ContextMethod: ...@@ -907,4 +785,4 @@ RSpec/ContextMethod:
- 'spec/services/projects/open_issues_count_service_spec.rb' - 'spec/services/projects/open_issues_count_service_spec.rb'
- 'spec/services/quick_actions/interpret_service_spec.rb' - 'spec/services/quick_actions/interpret_service_spec.rb'
- 'spec/support/shared_examples/services/boards/issues_list_service_shared_examples.rb' - 'spec/support/shared_examples/services/boards/issues_list_service_shared_examples.rb'
- 'spec/uploaders/namespace_file_uploader_spec.rb' - 'spec/uploaders/namespace_file_uploader_spec.rb'
\ No newline at end of file
...@@ -132,11 +132,6 @@ export default { ...@@ -132,11 +132,6 @@ export default {
type: String, type: String,
required: true, required: true,
}, },
environmentsEndpoint: {
type: String,
required: false,
default: '',
},
currentEnvironmentName: { currentEnvironmentName: {
type: String, type: String,
required: true, required: true,
...@@ -218,9 +213,7 @@ export default { ...@@ -218,9 +213,7 @@ export default {
]), ]),
...mapGetters('monitoringDashboard', ['getMetricStates', 'filteredEnvironments']), ...mapGetters('monitoringDashboard', ['getMetricStates', 'filteredEnvironments']),
firstDashboard() { firstDashboard() {
return this.environmentsEndpoint.length > 0 && this.allDashboards.length > 0 return this.allDashboards.length > 0 ? this.allDashboards[0] : {};
? this.allDashboards[0]
: {};
}, },
selectedDashboard() { selectedDashboard() {
return this.allDashboards.find(d => d.path === this.currentDashboard) || this.firstDashboard; return this.allDashboards.find(d => d.path === this.currentDashboard) || this.firstDashboard;
...@@ -246,7 +239,6 @@ export default { ...@@ -246,7 +239,6 @@ export default {
created() { created() {
this.setEndpoints({ this.setEndpoints({
metricsEndpoint: this.metricsEndpoint, metricsEndpoint: this.metricsEndpoint,
environmentsEndpoint: this.environmentsEndpoint,
deploymentsEndpoint: this.deploymentsEndpoint, deploymentsEndpoint: this.deploymentsEndpoint,
dashboardEndpoint: this.dashboardEndpoint, dashboardEndpoint: this.dashboardEndpoint,
dashboardsEndpoint: this.dashboardsEndpoint, dashboardsEndpoint: this.dashboardsEndpoint,
......
...@@ -172,7 +172,6 @@ export default { ...@@ -172,7 +172,6 @@ export default {
[types.SET_ENDPOINTS](state, endpoints) { [types.SET_ENDPOINTS](state, endpoints) {
state.metricsEndpoint = endpoints.metricsEndpoint; state.metricsEndpoint = endpoints.metricsEndpoint;
state.environmentsEndpoint = endpoints.environmentsEndpoint;
state.deploymentsEndpoint = endpoints.deploymentsEndpoint; state.deploymentsEndpoint = endpoints.deploymentsEndpoint;
state.dashboardEndpoint = endpoints.dashboardEndpoint; state.dashboardEndpoint = endpoints.dashboardEndpoint;
state.dashboardsEndpoint = endpoints.dashboardsEndpoint; state.dashboardsEndpoint = endpoints.dashboardsEndpoint;
......
...@@ -2,7 +2,6 @@ import invalidUrl from '~/lib/utils/invalid_url'; ...@@ -2,7 +2,6 @@ import invalidUrl from '~/lib/utils/invalid_url';
export default () => ({ export default () => ({
metricsEndpoint: null, metricsEndpoint: null,
environmentsEndpoint: null,
deploymentsEndpoint: null, deploymentsEndpoint: null,
dashboardEndpoint: invalidUrl, dashboardEndpoint: invalidUrl,
emptyState: 'gettingStarted', emptyState: 'gettingStarted',
......
<script> <script>
import { GlButton } from '@gitlab/ui';
import ClipboardButton from '../../vue_shared/components/clipboard_button.vue'; import ClipboardButton from '../../vue_shared/components/clipboard_button.vue';
import Icon from '~/vue_shared/components/icon.vue';
export default { export default {
components: { components: {
Icon,
GlButton,
ClipboardButton, ClipboardButton,
}, },
props: { props: {
...@@ -26,13 +22,5 @@ export default { ...@@ -26,13 +22,5 @@ export default {
:title="s__('ServerlessURL|Copy URL')" :title="s__('ServerlessURL|Copy URL')"
class="input-group-text js-clipboard-btn" class="input-group-text js-clipboard-btn"
/> />
<gl-button
:href="uri"
target="_blank"
rel="noopener noreferrer nofollow"
class="input-group-text btn btn-default"
>
<icon name="external-link" />
</gl-button>
</div> </div>
</template> </template>
...@@ -146,9 +146,15 @@ export default { ...@@ -146,9 +146,15 @@ export default {
auto_merge_strategy: useAutoMerge ? this.mr.preferredAutoMergeStrategy : undefined, auto_merge_strategy: useAutoMerge ? this.mr.preferredAutoMergeStrategy : undefined,
should_remove_source_branch: this.removeSourceBranch === true, should_remove_source_branch: this.removeSourceBranch === true,
squash: this.squashBeforeMerge, squash: this.squashBeforeMerge,
squash_commit_message: this.squashCommitMessage,
}; };
// If users can't alter the squash message (e.g. for 1-commit merge requests),
// we shouldn't send the commit message because that would make the backend
// do unnecessary work.
if (this.shouldShowSquashBeforeMerge) {
options.squash_commit_message = this.squashCommitMessage;
}
this.isMakingRequest = true; this.isMakingRequest = true;
this.service this.service
.merge(options) .merge(options)
......
...@@ -66,6 +66,8 @@ def load_projects(finder_params) ...@@ -66,6 +66,8 @@ def load_projects(finder_params)
@total_user_projects_count = ProjectsFinder.new(params: { non_public: true }, current_user: current_user).execute @total_user_projects_count = ProjectsFinder.new(params: { non_public: true }, current_user: current_user).execute
@total_starred_projects_count = ProjectsFinder.new(params: { starred: true }, current_user: current_user).execute @total_starred_projects_count = ProjectsFinder.new(params: { starred: true }, current_user: current_user).execute
finder_params[:use_cte] = Feature.enabled?(:use_cte_for_projects_finder, default_enabled: true)
projects = ProjectsFinder projects = ProjectsFinder
.new(params: finder_params, current_user: current_user) .new(params: finder_params, current_user: current_user)
.execute .execute
......
...@@ -44,6 +44,8 @@ def execute ...@@ -44,6 +44,8 @@ def execute
init_collection init_collection
end end
use_cte = params.delete(:use_cte)
collection = Project.wrap_authorized_projects_with_cte(collection) if use_cte
collection = filter_projects(collection) collection = filter_projects(collection)
sort(collection) sort(collection)
end end
...@@ -177,7 +179,7 @@ def by_deleted_status(items) ...@@ -177,7 +179,7 @@ def by_deleted_status(items)
end end
def sort(items) def sort(items)
params[:sort].present? ? items.sort_by_attribute(params[:sort]) : items.order_id_desc params[:sort].present? ? items.sort_by_attribute(params[:sort]) : items.projects_order_id_desc
end end
def by_archived(projects) def by_archived(projects)
......
...@@ -33,7 +33,6 @@ def metrics_data(project, environment) ...@@ -33,7 +33,6 @@ def metrics_data(project, environment)
"dashboard-endpoint" => metrics_dashboard_project_environment_path(project, environment, format: :json), "dashboard-endpoint" => metrics_dashboard_project_environment_path(project, environment, format: :json),
"deployments-endpoint" => project_environment_deployments_path(project, environment, format: :json), "deployments-endpoint" => project_environment_deployments_path(project, environment, format: :json),
"default-branch" => project.default_branch, "default-branch" => project.default_branch,
"environments-endpoint": project_environments_path(project, format: :json),
"project-path" => project_path(project), "project-path" => project_path(project),
"tags-path" => project_tags_path(project), "tags-path" => project_tags_path(project),
"has-metrics" => "#{environment.has_metrics?}", "has-metrics" => "#{environment.has_metrics?}",
......
# frozen_string_literal: true # frozen_string_literal: true
class AbuseReportMailer < BaseMailer class AbuseReportMailer < ApplicationMailer
layout 'empty_mailer' layout 'empty_mailer'
helper EmailsHelper helper EmailsHelper
......
# frozen_string_literal: true # frozen_string_literal: true
class BaseMailer < ActionMailer::Base class ApplicationMailer < ActionMailer::Base
around_action :render_with_default_locale around_action :render_with_default_locale
helper ApplicationHelper helper ApplicationHelper
......
# frozen_string_literal: true # frozen_string_literal: true
class EmailRejectionMailer < BaseMailer class EmailRejectionMailer < ApplicationMailer
layout 'empty_mailer' layout 'empty_mailer'
helper EmailsHelper helper EmailsHelper
......
# frozen_string_literal: true # frozen_string_literal: true
class Notify < BaseMailer class Notify < ApplicationMailer
include ActionDispatch::Routing::PolymorphicRoutes include ActionDispatch::Routing::PolymorphicRoutes
include GitlabRoutingHelper include GitlabRoutingHelper
include EmailsHelper include EmailsHelper
......
# frozen_string_literal: true # frozen_string_literal: true
class RepositoryCheckMailer < BaseMailer class RepositoryCheckMailer < ApplicationMailer
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
layout 'empty_mailer' layout 'empty_mailer'
......
...@@ -142,7 +142,7 @@ class ApplicationSetting < ApplicationRecord ...@@ -142,7 +142,7 @@ class ApplicationSetting < ApplicationRecord
if: :auto_devops_enabled? if: :auto_devops_enabled?
validates :enabled_git_access_protocol, validates :enabled_git_access_protocol,
inclusion: { in: %w(ssh http), allow_blank: true, allow_nil: true } inclusion: { in: %w(ssh http), allow_blank: true }
validates :domain_blacklist, validates :domain_blacklist,
presence: { message: 'Domain blacklist cannot be empty if Blacklist is enabled.' }, presence: { message: 'Domain blacklist cannot be empty if Blacklist is enabled.' },
......
...@@ -16,7 +16,7 @@ class ElasticStack < ApplicationRecord ...@@ -16,7 +16,7 @@ class ElasticStack < ApplicationRecord
include ::Gitlab::Utils::StrongMemoize include ::Gitlab::Utils::StrongMemoize
include IgnorableColumns include IgnorableColumns
ignore_column :kibana_hostname, remove_with: '12.8', remove_after: '2020-01-22' ignore_column :kibana_hostname, remove_with: '12.9', remove_after: '2020-02-22'
default_value_for :version, VERSION default_value_for :version, VERSION
......
...@@ -237,8 +237,7 @@ def calculate_relative_position(calculation) ...@@ -237,8 +237,7 @@ def calculate_relative_position(calculation)
relation relation
.pluck(self.class.relative_positioning_parent_column, Arel.sql("#{calculation}(relative_position) AS position")) .pluck(self.class.relative_positioning_parent_column, Arel.sql("#{calculation}(relative_position) AS position"))
.first&. .first&.last
last
end end
def scoped_items def scoped_items
......
...@@ -63,7 +63,7 @@ def last_resolved_note ...@@ -63,7 +63,7 @@ def last_resolved_note
return unless resolved? return unless resolved?
strong_memoize(:last_resolved_note) do strong_memoize(:last_resolved_note) do
resolved_notes.sort_by(&:resolved_at).last resolved_notes.max_by(&:resolved_at)
end end
end end
......
...@@ -397,6 +397,8 @@ class Project < ApplicationRecord ...@@ -397,6 +397,8 @@ class Project < ApplicationRecord
scope :sorted_by_stars_desc, -> { reorder(star_count: :desc) } scope :sorted_by_stars_desc, -> { reorder(star_count: :desc) }
scope :sorted_by_stars_asc, -> { reorder(star_count: :asc) } scope :sorted_by_stars_asc, -> { reorder(star_count: :asc) }
scope :sorted_by_name_asc_limited, ->(limit) { reorder(name: :asc).limit(limit) } scope :sorted_by_name_asc_limited, ->(limit) { reorder(name: :asc).limit(limit) }
# Sometimes queries (e.g. using CTEs) require explicit