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:
- 'spec/support/helpers/stub_object_storage.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
# Cop supports --auto-correct.
Layout/EmptyLinesAroundArguments:
......@@ -100,12 +92,6 @@ Layout/IndentFirstParameter:
- 'spec/support/helpers/repo_helpers.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
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, IndentationWidth.
......@@ -150,11 +136,6 @@ Layout/SpaceInsideBlockBraces:
Layout/SpaceInsideParens:
Enabled: false
# Offense count: 1
Lint/DisjunctiveAssignmentInConstructor:
Exclude:
- 'app/models/uploads/base.rb'
# Offense count: 19
Lint/DuplicateMethods:
Exclude:
......@@ -177,21 +158,6 @@ Lint/DuplicateMethods:
Lint/MissingCopEnableDirective:
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
Lint/UriEscapeUnescape:
Exclude:
......@@ -200,12 +166,6 @@ Lint/UriEscapeUnescape:
- 'spec/lib/google_api/auth_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
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
......@@ -284,12 +244,6 @@ RSpec/LetBeforeExamples:
- 'spec/rubocop/cop/migration/update_column_in_batches_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
# Cop supports --auto-correct.
# Configuration parameters: Strict, EnforcedStyle, AllowedExplicitMatchers.
......@@ -319,12 +273,6 @@ RSpec/ScatteredSetup:
- 'spec/requests/api/jobs_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
RSpec/VoidExpect:
Exclude:
......@@ -348,12 +296,6 @@ Rails/ApplicationController:
- 'spec/controllers/concerns/continue_params_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
# Cop supports --auto-correct.
Rails/BelongsTo:
......@@ -414,14 +356,6 @@ Rails/LinkToBlank:
Rails/RakeEnvironment:
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
# Configuration parameters: Blacklist, Whitelist.
# 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:
- 'lib/tasks/gitlab/backup.rake'
- 'spec/tasks/gitlab/backup_rake_spec.rb'
# Offense count: 1
# Cop supports --auto-correct.
Style/Dir:
Exclude:
- 'qa/qa.rb'
# Offense count: 6
# Cop supports --auto-correct.
Style/EachWithObject:
......@@ -591,13 +519,6 @@ Style/NumericLiteralPrefix:
Style/NumericPredicate:
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
# Cop supports --auto-correct.
Style/ParallelAssignment:
......@@ -632,12 +553,6 @@ Style/PerlBackrefs:
Style/RaiseArgs:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
Style/RedundantConditional:
Exclude:
- 'lib/system_check/helpers.rb'
# Offense count: 221
# Cop supports --auto-correct.
Style/RedundantFreeze:
......@@ -704,12 +619,6 @@ Style/SingleLineMethods:
Style/SpecialGlobalVars:
EnforcedStyle: use_perl_names
# Offense count: 1
# Cop supports --auto-correct.
Style/StderrPuts:
Exclude:
- 'config/initializers/rspec_profiling.rb'
# Offense count: 75
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
......@@ -736,30 +645,6 @@ Style/TernaryParentheses:
- 'spec/requests/api/pipeline_schedules_spec.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
# Cop supports --auto-correct.
Style/UnneededCondition:
......@@ -776,13 +661,6 @@ Style/UnneededCondition:
Style/UnneededInterpolation:
Enabled: false
# Offense count: 2
# Cop supports --auto-correct.
Style/UnneededSort:
Exclude:
- 'app/models/concerns/resolvable_discussion.rb'
- 'lib/gitlab/highlight.rb'
RSpec/ReceiveCounts:
Exclude:
- 'ee/spec/models/broadcast_message_spec.rb'
......@@ -907,4 +785,4 @@ RSpec/ContextMethod:
- 'spec/services/projects/open_issues_count_service_spec.rb'
- 'spec/services/quick_actions/interpret_service_spec.rb'
- 'spec/support/shared_examples/services/boards/issues_list_service_shared_examples.rb'
- 'spec/uploaders/namespace_file_uploader_spec.rb'
\ No newline at end of file
- 'spec/uploaders/namespace_file_uploader_spec.rb'
......@@ -132,11 +132,6 @@ export default {
type: String,
required: true,
},
environmentsEndpoint: {
type: String,
required: false,
default: '',
},
currentEnvironmentName: {
type: String,
required: true,
......@@ -218,9 +213,7 @@ export default {
]),
...mapGetters('monitoringDashboard', ['getMetricStates', 'filteredEnvironments']),
firstDashboard() {
return this.environmentsEndpoint.length > 0 && this.allDashboards.length > 0
? this.allDashboards[0]
: {};
return this.allDashboards.length > 0 ? this.allDashboards[0] : {};
},
selectedDashboard() {
return this.allDashboards.find(d => d.path === this.currentDashboard) || this.firstDashboard;
......@@ -246,7 +239,6 @@ export default {
created() {
this.setEndpoints({
metricsEndpoint: this.metricsEndpoint,
environmentsEndpoint: this.environmentsEndpoint,
deploymentsEndpoint: this.deploymentsEndpoint,
dashboardEndpoint: this.dashboardEndpoint,
dashboardsEndpoint: this.dashboardsEndpoint,
......
......@@ -172,7 +172,6 @@ export default {
[types.SET_ENDPOINTS](state, endpoints) {
state.metricsEndpoint = endpoints.metricsEndpoint;
state.environmentsEndpoint = endpoints.environmentsEndpoint;
state.deploymentsEndpoint = endpoints.deploymentsEndpoint;
state.dashboardEndpoint = endpoints.dashboardEndpoint;
state.dashboardsEndpoint = endpoints.dashboardsEndpoint;
......
......@@ -2,7 +2,6 @@ import invalidUrl from '~/lib/utils/invalid_url';
export default () => ({
metricsEndpoint: null,
environmentsEndpoint: null,
deploymentsEndpoint: null,
dashboardEndpoint: invalidUrl,
emptyState: 'gettingStarted',
......
<script>
import { GlButton } from '@gitlab/ui';
import ClipboardButton from '../../vue_shared/components/clipboard_button.vue';
import Icon from '~/vue_shared/components/icon.vue';
export default {
components: {
Icon,
GlButton,
ClipboardButton,
},
props: {
......@@ -26,13 +22,5 @@ export default {
:title="s__('ServerlessURL|Copy URL')"
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>
</template>
......@@ -146,9 +146,15 @@ export default {
auto_merge_strategy: useAutoMerge ? this.mr.preferredAutoMergeStrategy : undefined,
should_remove_source_branch: this.removeSourceBranch === true,
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.service
.merge(options)
......
......@@ -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_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
.new(params: finder_params, current_user: current_user)
.execute
......
......@@ -44,6 +44,8 @@ def execute
init_collection
end
use_cte = params.delete(:use_cte)
collection = Project.wrap_authorized_projects_with_cte(collection) if use_cte
collection = filter_projects(collection)
sort(collection)
end
......@@ -177,7 +179,7 @@ def by_deleted_status(items)
end
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
def by_archived(projects)
......
......@@ -33,7 +33,6 @@ def metrics_data(project, environment)
"dashboard-endpoint" => metrics_dashboard_project_environment_path(project, environment, format: :json),
"deployments-endpoint" => project_environment_deployments_path(project, environment, format: :json),
"default-branch" => project.default_branch,
"environments-endpoint": project_environments_path(project, format: :json),
"project-path" => project_path(project),
"tags-path" => project_tags_path(project),
"has-metrics" => "#{environment.has_metrics?}",
......
# frozen_string_literal: true
class AbuseReportMailer < BaseMailer
class AbuseReportMailer < ApplicationMailer
layout 'empty_mailer'
helper EmailsHelper
......
# frozen_string_literal: true
class BaseMailer < ActionMailer::Base
class ApplicationMailer < ActionMailer::Base
around_action :render_with_default_locale
helper ApplicationHelper
......
# frozen_string_literal: true
class EmailRejectionMailer < BaseMailer
class EmailRejectionMailer < ApplicationMailer
layout 'empty_mailer'
helper EmailsHelper
......
# frozen_string_literal: true
class Notify < BaseMailer
class Notify < ApplicationMailer
include ActionDispatch::Routing::PolymorphicRoutes
include GitlabRoutingHelper
include EmailsHelper
......
# frozen_string_literal: true
class RepositoryCheckMailer < BaseMailer
class RepositoryCheckMailer < ApplicationMailer
# rubocop: disable CodeReuse/ActiveRecord
layout 'empty_mailer'
......
......@@ -142,7 +142,7 @@ class ApplicationSetting < ApplicationRecord
if: :auto_devops_enabled?
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,
presence: { message: 'Domain blacklist cannot be empty if Blacklist is enabled.' },
......
......@@ -16,7 +16,7 @@ class ElasticStack < ApplicationRecord
include ::Gitlab::Utils::StrongMemoize
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
......
......@@ -237,8 +237,7 @@ def calculate_relative_position(calculation)
relation
.pluck(self.class.relative_positioning_parent_column, Arel.sql("#{calculation}(relative_position) AS position"))
.first&.
last
.first&.last
end
def scoped_items
......
......@@ -63,7 +63,7 @@ def last_resolved_note
return unless resolved?
strong_memoize(:last_resolved_note) do
resolved_notes.sort_by(&:resolved_at).last
resolved_notes.max_by(&:resolved_at)
end
end
......
......@@ -397,6 +397,8 @@ class Project < ApplicationRecord
scope :sorted_by_stars_desc, -> { reorder(star_count: :desc) }
scope :sorted_by_stars_asc, -> { reorder(star_count: :asc) }
scope :sorted_by_name_asc_limited, ->(limit) { reorder(name: :asc).limit(limit) }
# Sometimes queries (e.g. using CTEs) require explicit disambiguation with table name
scope :projects_order_id_desc, -> { reorder("#{table_name}.id DESC") }
scope :in_namespace, ->(namespace_ids) { where(namespace_id: namespace_ids) }
scope :personal, ->(user) { where(namespace_id: user.namespace_id) }
......@@ -543,6 +545,11 @@ def self.filter_by_feature_visibility(feature, user)
)
end
def self.wrap_authorized_projects_with_cte(collection)
cte = Gitlab::SQL::CTE.new(:authorized_projects, collection)
Project.with(cte.to_arel).from(cte.alias_to(Project.arel_table))
end
scope :active, -> { joins(:issues, :notes, :merge_requests).order('issues.created_at, notes.created_at, merge_requests.created_at DESC') }
scope :abandoned, -> { where('projects.last_activity_at < ?', 6.months.ago) }
......
......@@ -7,7 +7,7 @@ class Base
attr_reader :logger
def initialize(logger: nil)
@logger ||= Rails.logger # rubocop:disable Gitlab/RailsLogger
@logger = Rails.logger # rubocop:disable Gitlab/RailsLogger
end
def delete_keys_async(keys_to_delete)
......
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