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-03-09 15:07:45 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-09 15:07:45 +0300
commitac1dca43baa7b3b1ac7d60d89ad60fdeefed0b80 (patch)
tree33aa23ddf7f18ddbfba3d006041c460de88583b7 /app
parentf4186a753b86625a83e8499af14b5badd63a2ac2 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/cycle_analytics/components/stage_nav_item.vue7
-rw-r--r--app/assets/stylesheets/pages/cycle_analytics.scss4
-rw-r--r--app/controllers/concerns/snippets_actions.rb7
-rw-r--r--app/controllers/projects/snippets_controller.rb2
-rw-r--r--app/controllers/repositories/git_http_controller.rb8
-rw-r--r--app/controllers/snippets_controller.rb2
-rw-r--r--app/models/concerns/issuable.rb14
-rw-r--r--app/serializers/pipeline_serializer.rb7
-rw-r--r--app/services/snippets/update_service.rb2
9 files changed, 39 insertions, 14 deletions
diff --git a/app/assets/javascripts/cycle_analytics/components/stage_nav_item.vue b/app/assets/javascripts/cycle_analytics/components/stage_nav_item.vue
index 1b09fe1b370..3c18608eb75 100644
--- a/app/assets/javascripts/cycle_analytics/components/stage_nav_item.vue
+++ b/app/assets/javascripts/cycle_analytics/components/stage_nav_item.vue
@@ -45,10 +45,13 @@ export default {
:class="{ active: isActive }"
class="stage-nav-item d-flex pl-4 pr-4 m-0 mb-1 ml-2 rounded border-color-default border-style-solid border-width-1px"
>
- <div class="stage-nav-item-cell stage-name p-0" :class="{ 'font-weight-bold': isActive }">
+ <div
+ class="stage-nav-item-cell stage-name w-50 pr-2"
+ :class="{ 'font-weight-bold': isActive }"
+ >
{{ title }}
</div>
- <div class="stage-nav-item-cell stage-median mr-4">
+ <div class="stage-nav-item-cell stage-median w-50">
<template v-if="isUserAllowed">
<span v-if="hasValue">{{ value }}</span>
<span v-else class="stage-empty">{{ __('Not enough data') }}</span>
diff --git a/app/assets/stylesheets/pages/cycle_analytics.scss b/app/assets/stylesheets/pages/cycle_analytics.scss
index 89b673397a2..b1d79a41ba7 100644
--- a/app/assets/stylesheets/pages/cycle_analytics.scss
+++ b/app/assets/stylesheets/pages/cycle_analytics.scss
@@ -51,11 +51,11 @@
}
.stage-header {
- width: 18.5%;
+ width: 20.5%;
}
.median-header {
- width: 21.5%;
+ width: 19.5%;
}
.event-header {
diff --git a/app/controllers/concerns/snippets_actions.rb b/app/controllers/concerns/snippets_actions.rb
index bb46345d362..f80e891a558 100644
--- a/app/controllers/concerns/snippets_actions.rb
+++ b/app/controllers/concerns/snippets_actions.rb
@@ -28,4 +28,11 @@ module SnippetsActions
def convert_line_endings(content)
params[:line_ending] == 'raw' ? content : content.gsub(/\r\n/, "\n")
end
+
+ def check_repository_error
+ repository_error = snippet.errors.delete(:repository)
+
+ flash.now[:alert] = repository_error if repository_error
+ recaptcha_check_with_fallback(repository_error.nil?) { render :edit }
+ end
end
diff --git a/app/controllers/projects/snippets_controller.rb b/app/controllers/projects/snippets_controller.rb
index 8317d9fc6d5..241df8d95d7 100644
--- a/app/controllers/projects/snippets_controller.rb
+++ b/app/controllers/projects/snippets_controller.rb
@@ -62,7 +62,7 @@ class Projects::SnippetsController < Projects::ApplicationController
service_response = Snippets::UpdateService.new(project, current_user, update_params).execute(@snippet)
@snippet = service_response.payload[:snippet]
- recaptcha_check_with_fallback { render :edit }
+ check_repository_error
end
def show
diff --git a/app/controllers/repositories/git_http_controller.rb b/app/controllers/repositories/git_http_controller.rb
index 5ce2ed77417..35ea77183b8 100644
--- a/app/controllers/repositories/git_http_controller.rb
+++ b/app/controllers/repositories/git_http_controller.rb
@@ -12,6 +12,8 @@ module Repositories
rescue_from Gitlab::GitAccess::ProjectCreationError, with: :render_422_with_exception
rescue_from Gitlab::GitAccess::TimeoutError, with: :render_503_with_exception
+ before_action :snippet_request_allowed?
+
# GET /foo/bar.git/info/refs?service=git-upload-pack (git pull)
# GET /foo/bar.git/info/refs?service=git-receive-pack (git push)
def info_refs
@@ -116,6 +118,12 @@ module Repositories
def log_user_activity
Users::ActivityService.new(user).execute
end
+
+ def snippet_request_allowed?
+ if repo_type.snippet? && Feature.disabled?(:version_snippets, user)
+ render plain: 'The project you were looking for could not be found.', status: :not_found
+ end
+ end
end
end
diff --git a/app/controllers/snippets_controller.rb b/app/controllers/snippets_controller.rb
index e6840e46226..3f8b13dbcdd 100644
--- a/app/controllers/snippets_controller.rb
+++ b/app/controllers/snippets_controller.rb
@@ -64,7 +64,7 @@ class SnippetsController < ApplicationController
service_response = Snippets::UpdateService.new(nil, current_user, update_params).execute(@snippet)
@snippet = service_response.payload[:snippet]
- recaptcha_check_with_fallback { render :edit }
+ check_repository_error
end
def show
diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb
index 78d815e5858..7300283f086 100644
--- a/app/models/concerns/issuable.rb
+++ b/app/models/concerns/issuable.rb
@@ -260,12 +260,14 @@ module Issuable
highest_priority = highest_label_priority(params).to_sql
- select_columns = [
- "#{table_name}.*",
- "(#{highest_priority}) AS highest_priority"
- ] + extra_select_columns
+ # When using CTE make sure to select the same columns that are on the group_by clause.
+ # This prevents errors when ignored columns are present in the database.
+ issuable_columns = with_cte ? issue_grouping_columns(use_cte: with_cte) : "#{table_name}.*"
- select(select_columns.join(', '))
+ extra_select_columns = extra_select_columns.unshift("(#{highest_priority}) AS highest_priority")
+
+ select(issuable_columns)
+ .select(extra_select_columns)
.group(issue_grouping_columns(use_cte: with_cte))
.reorder(Gitlab::Database.nulls_last_order('highest_priority', direction))
end
@@ -301,7 +303,7 @@ module Issuable
# Returns an array of arel columns
def issue_grouping_columns(use_cte: false)
if use_cte
- [arel_table[:state]] + attribute_names.map { |attr| arel_table[attr.to_sym] }
+ attribute_names.map { |attr| arel_table[attr.to_sym] }
else
arel_table[:id]
end
diff --git a/app/serializers/pipeline_serializer.rb b/app/serializers/pipeline_serializer.rb
index 3ad9f2bc0bf..b2c0ceb640b 100644
--- a/app/serializers/pipeline_serializer.rb
+++ b/app/serializers/pipeline_serializer.rb
@@ -56,9 +56,14 @@ class PipelineSerializer < BaseSerializer
:manual_actions,
:scheduled_actions,
:artifacts,
- :merge_request,
:user,
{
+ merge_request: {
+ source_project: [:route, { namespace: :route }],
+ target_project: [:route, { namespace: :route }]
+ }
+ },
+ {
pending_builds: :project,
project: [:route, { namespace: :route }],
artifacts: {
diff --git a/app/services/snippets/update_service.rb b/app/services/snippets/update_service.rb
index c2949ebadbf..874357f36cc 100644
--- a/app/services/snippets/update_service.rb
+++ b/app/services/snippets/update_service.rb
@@ -52,7 +52,7 @@ module Snippets
create_commit(snippet) if snippet.repository_exists?
end
rescue
- snippet.errors.add(:base, 'Error updating the snippet')
+ snippet.errors.add(:repository, 'Error updating the snippet')
false
end