Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-28 00:08:47 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-28 00:08:47 +0300
commite4ea43b2b85ad5f3115f00220601eb719705139a (patch)
tree1888a43f802e45ebb8dfed59595a790807777c6f /app
parent390582e118752426acf5cb25ec99103d312d891c (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/monitoring/components/dashboard.vue10
-rw-r--r--app/assets/javascripts/monitoring/stores/mutations.js1
-rw-r--r--app/assets/javascripts/monitoring/stores/state.js1
-rw-r--r--app/assets/javascripts/serverless/components/url.vue12
-rw-r--r--app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue8
-rw-r--r--app/controllers/dashboard/projects_controller.rb2
-rw-r--r--app/finders/projects_finder.rb4
-rw-r--r--app/helpers/environments_helper.rb1
-rw-r--r--app/mailers/abuse_report_mailer.rb2
-rw-r--r--app/mailers/application_mailer.rb (renamed from app/mailers/base_mailer.rb)2
-rw-r--r--app/mailers/email_rejection_mailer.rb2
-rw-r--r--app/mailers/notify.rb2
-rw-r--r--app/mailers/repository_check_mailer.rb2
-rw-r--r--app/models/application_setting.rb2
-rw-r--r--app/models/clusters/applications/elastic_stack.rb2
-rw-r--r--app/models/concerns/relative_positioning.rb3
-rw-r--r--app/models/concerns/resolvable_discussion.rb2
-rw-r--r--app/models/project.rb7
-rw-r--r--app/models/uploads/base.rb2
-rw-r--r--app/views/clusters/clusters/show.html.haml2
20 files changed, 31 insertions, 38 deletions
diff --git a/app/assets/javascripts/monitoring/components/dashboard.vue b/app/assets/javascripts/monitoring/components/dashboard.vue
index 9b9c380c9af..c34623cf858 100644
--- a/app/assets/javascripts/monitoring/components/dashboard.vue
+++ b/app/assets/javascripts/monitoring/components/dashboard.vue
@@ -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,
diff --git a/app/assets/javascripts/monitoring/stores/mutations.js b/app/assets/javascripts/monitoring/stores/mutations.js
index e14425d7c6c..f0390bfc636 100644
--- a/app/assets/javascripts/monitoring/stores/mutations.js
+++ b/app/assets/javascripts/monitoring/stores/mutations.js
@@ -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;
diff --git a/app/assets/javascripts/monitoring/stores/state.js b/app/assets/javascripts/monitoring/stores/state.js
index 2c6758dfce2..2a2a7c9c88d 100644
--- a/app/assets/javascripts/monitoring/stores/state.js
+++ b/app/assets/javascripts/monitoring/stores/state.js
@@ -2,7 +2,6 @@ import invalidUrl from '~/lib/utils/invalid_url';
export default () => ({
metricsEndpoint: null,
- environmentsEndpoint: null,
deploymentsEndpoint: null,
dashboardEndpoint: invalidUrl,
emptyState: 'gettingStarted',
diff --git a/app/assets/javascripts/serverless/components/url.vue b/app/assets/javascripts/serverless/components/url.vue
index 5e30c8d614e..d6de5e56a5c 100644
--- a/app/assets/javascripts/serverless/components/url.vue
+++ b/app/assets/javascripts/serverless/components/url.vue
@@ -1,12 +1,8 @@
<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>
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 d230ac566de..66167a0d748 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
@@ -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)
diff --git a/app/controllers/dashboard/projects_controller.rb b/app/controllers/dashboard/projects_controller.rb
index 9659d7719b9..d5ccec28fdd 100644
--- a/app/controllers/dashboard/projects_controller.rb
+++ b/app/controllers/dashboard/projects_controller.rb
@@ -66,6 +66,8 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController
@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
diff --git a/app/finders/projects_finder.rb b/app/finders/projects_finder.rb
index ac18c17dc61..7cac8deea07 100644
--- a/app/finders/projects_finder.rb
+++ b/app/finders/projects_finder.rb
@@ -44,6 +44,8 @@ class ProjectsFinder < UnionFinder
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 @@ class ProjectsFinder < UnionFinder
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)
diff --git a/app/helpers/environments_helper.rb b/app/helpers/environments_helper.rb
index 993c18f9229..579a57a27de 100644
--- a/app/helpers/environments_helper.rb
+++ b/app/helpers/environments_helper.rb
@@ -33,7 +33,6 @@ module EnvironmentsHelper
"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?}",
diff --git a/app/mailers/abuse_report_mailer.rb b/app/mailers/abuse_report_mailer.rb
index e0aa66e6de3..0f2f63b43f5 100644
--- a/app/mailers/abuse_report_mailer.rb
+++ b/app/mailers/abuse_report_mailer.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-class AbuseReportMailer < BaseMailer
+class AbuseReportMailer < ApplicationMailer
layout 'empty_mailer'
helper EmailsHelper
diff --git a/app/mailers/base_mailer.rb b/app/mailers/application_mailer.rb
index 5fd209c4761..e0c95370072 100644
--- a/app/mailers/base_mailer.rb
+++ b/app/mailers/application_mailer.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-class BaseMailer < ActionMailer::Base
+class ApplicationMailer < ActionMailer::Base
around_action :render_with_default_locale
helper ApplicationHelper
diff --git a/app/mailers/email_rejection_mailer.rb b/app/mailers/email_rejection_mailer.rb
index d743533b1bc..25721658285 100644
--- a/app/mailers/email_rejection_mailer.rb
+++ b/app/mailers/email_rejection_mailer.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-class EmailRejectionMailer < BaseMailer
+class EmailRejectionMailer < ApplicationMailer
layout 'empty_mailer'
helper EmailsHelper
diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb
index 92939136de2..49eacc44519 100644
--- a/app/mailers/notify.rb
+++ b/app/mailers/notify.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-class Notify < BaseMailer
+class Notify < ApplicationMailer
include ActionDispatch::Routing::PolymorphicRoutes
include GitlabRoutingHelper
include EmailsHelper
diff --git a/app/mailers/repository_check_mailer.rb b/app/mailers/repository_check_mailer.rb
index aa56ba1828b..b8f990f26c8 100644
--- a/app/mailers/repository_check_mailer.rb
+++ b/app/mailers/repository_check_mailer.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-class RepositoryCheckMailer < BaseMailer
+class RepositoryCheckMailer < ApplicationMailer
# rubocop: disable CodeReuse/ActiveRecord
layout 'empty_mailer'
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb
index 10d15e84b8d..0bea5d7b399 100644
--- a/app/models/application_setting.rb
+++ b/app/models/application_setting.rb
@@ -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.' },
diff --git a/app/models/clusters/applications/elastic_stack.rb b/app/models/clusters/applications/elastic_stack.rb
index e86a4597ed8..de7d3ab3fdb 100644
--- a/app/models/clusters/applications/elastic_stack.rb
+++ b/app/models/clusters/applications/elastic_stack.rb
@@ -16,7 +16,7 @@ module Clusters
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
diff --git a/app/models/concerns/relative_positioning.rb b/app/models/concerns/relative_positioning.rb
index b645cf71443..1653ecdb305 100644
--- a/app/models/concerns/relative_positioning.rb
+++ b/app/models/concerns/relative_positioning.rb
@@ -237,8 +237,7 @@ module RelativePositioning
relation
.pluck(self.class.relative_positioning_parent_column, Arel.sql("#{calculation}(relative_position) AS position"))
- .first&.
- last
+ .first&.last
end
def scoped_items
diff --git a/app/models/concerns/resolvable_discussion.rb b/app/models/concerns/resolvable_discussion.rb
index c0490af2453..5d78eea7fca 100644
--- a/app/models/concerns/resolvable_discussion.rb
+++ b/app/models/concerns/resolvable_discussion.rb
@@ -63,7 +63,7 @@ module ResolvableDiscussion
return unless resolved?
strong_memoize(:last_resolved_note) do
- resolved_notes.sort_by(&:resolved_at).last
+ resolved_notes.max_by(&:resolved_at)
end
end
diff --git a/app/models/project.rb b/app/models/project.rb
index a51dd3c1048..b2de2b32ae0 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -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 @@ class Project < ApplicationRecord
)
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) }
diff --git a/app/models/uploads/base.rb b/app/models/uploads/base.rb
index 29f376670da..442ed733566 100644
--- a/app/models/uploads/base.rb
+++ b/app/models/uploads/base.rb
@@ -7,7 +7,7 @@ module Uploads
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)
diff --git a/app/views/clusters/clusters/show.html.haml b/app/views/clusters/clusters/show.html.haml
index 4b295cd022d..59ce28d2d26 100644
--- a/app/views/clusters/clusters/show.html.haml
+++ b/app/views/clusters/clusters/show.html.haml
@@ -29,7 +29,7 @@
pre_installed_knative: @cluster.knative_pre_installed? ? 'true': 'false',
help_path: help_page_path('user/project/clusters/index.md', anchor: 'installing-applications'),
ingress_help_path: help_page_path('user/project/clusters/index.md', anchor: 'getting-the-external-endpoint'),
- ingress_dns_help_path: help_page_path('user/project/clusters/index.md', anchor: 'manually-determining-the-external-endpoint'),
+ ingress_dns_help_path: help_page_path('user/clusters/applications.md', anchor: 'pointing-your-dns-at-the-external-endpoint'),
ingress_mod_security_help_path: help_page_path('user/clusters/applications.md', anchor: 'web-application-firewall-modsecurity'),
environments_help_path: help_page_path('ci/environments', anchor: 'defining-environments'),
clusters_help_path: help_page_path('user/project/clusters/index.md', anchor: 'deploying-to-a-kubernetes-cluster'),