summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-10-14 16:34:10 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-10-14 16:34:10 +0000
commitbfa4e0b43c216ba5f3201058668d3a65743a9910 (patch)
tree2265d2644cc8821128a3de731aff762b14564690
parent6689552c4793623a9d47986328a0379ab215f9bc (diff)
downloadgitlab-ce-bfa4e0b43c216ba5f3201058668d3a65743a9910.tar.gz
Add latest changes from gitlab-org/gitlab@13-4-stable-ee
-rw-r--r--app/assets/javascripts/diffs/components/diff_file.vue38
-rw-r--r--app/assets/javascripts/diffs/i18n.js14
-rw-r--r--changelogs/unreleased/patch-migration.yml5
-rw-r--r--changelogs/unreleased/revert-42465-and-42343.yml5
-rw-r--r--changelogs/unreleased/sh-improve-pre-receive-error-ff-merge-message.yml5
-rw-r--r--db/migrate/20200820105408_add_index_to_container_scanning_findings.rb2
-rw-r--r--lib/gitlab/git/pre_receive_error.rb10
-rw-r--r--lib/gitlab/gitaly_client/operation_service.rb2
-rw-r--r--locale/gitlab.pot6
-rw-r--r--spec/features/merge_request/user_expands_diff_spec.rb4
-rw-r--r--spec/frontend/diffs/components/diff_file_spec.js16
-rw-r--r--spec/lib/gitlab/git/pre_receive_error_spec.rb16
-rw-r--r--spec/services/merge_requests/ff_merge_service_spec.rb2
13 files changed, 60 insertions, 65 deletions
diff --git a/app/assets/javascripts/diffs/components/diff_file.vue b/app/assets/javascripts/diffs/components/diff_file.vue
index 9a7ed76bad3..02396a4ba1b 100644
--- a/app/assets/javascripts/diffs/components/diff_file.vue
+++ b/app/assets/javascripts/diffs/components/diff_file.vue
@@ -1,32 +1,26 @@
<script>
import { mapActions, mapGetters, mapState } from 'vuex';
import { escape } from 'lodash';
-import { GlButton, GlLoadingIcon, GlSafeHtmlDirective as SafeHtml } from '@gitlab/ui';
+import { GlLoadingIcon, GlSafeHtmlDirective as SafeHtml } from '@gitlab/ui';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
-import { sprintf } from '~/locale';
+import { __, sprintf } from '~/locale';
import { deprecatedCreateFlash as createFlash } from '~/flash';
import { hasDiff } from '~/helpers/diffs_helper';
import eventHub from '../../notes/event_hub';
import DiffFileHeader from './diff_file_header.vue';
import DiffContent from './diff_content.vue';
import { diffViewerErrors } from '~/ide/constants';
-import { GENERIC_ERROR, DIFF_FILE } from '../i18n';
export default {
components: {
DiffFileHeader,
DiffContent,
- GlButton,
GlLoadingIcon,
},
directives: {
SafeHtml,
},
mixins: [glFeatureFlagsMixin()],
- i18n: {
- genericError: GENERIC_ERROR,
- ...DIFF_FILE,
- },
props: {
file: {
type: Object,
@@ -59,7 +53,7 @@ export default {
...mapGetters('diffs', ['getDiffFileDiscussions']),
viewBlobLink() {
return sprintf(
- this.$options.i18n.blobView,
+ __('You can %{linkStart}view the blob%{linkEnd} instead.'),
{
linkStart: `<a href="${escape(this.file.view_path)}">`,
linkEnd: '</a>',
@@ -81,7 +75,9 @@ export default {
},
forkMessage() {
return sprintf(
- this.$options.i18n.editInFork,
+ __(
+ "You're not allowed to %{tag_start}edit%{tag_end} files in this project directly. Please fork this project, make your changes there, and submit a merge request.",
+ ),
{
tag_start: '<span class="js-file-fork-suggestion-section-action">',
tag_end: '</span>',
@@ -152,7 +148,7 @@ export default {
})
.catch(() => {
this.isLoadingCollapsedDiff = false;
- createFlash(this.$options.i18n.genericError);
+ createFlash(__('Something went wrong on our end. Please try again!'));
});
},
showForkMessage() {
@@ -192,14 +188,14 @@ export default {
<a
:href="file.fork_path"
class="js-fork-suggestion-button btn btn-grouped btn-inverted btn-success"
- >{{ $options.i18n.fork }}</a
+ >{{ __('Fork') }}</a
>
<button
class="js-cancel-fork-suggestion-button btn btn-grouped"
type="button"
@click="hideForkMessage"
>
- {{ $options.i18n.cancel }}
+ {{ __('Cancel') }}
</button>
</div>
<gl-loading-icon v-if="showLoadingIcon" class="diff-content loading" />
@@ -209,17 +205,11 @@ export default {
<div v-safe-html="errorMessage" class="nothing-here-block"></div>
</div>
<template v-else>
- <div v-show="isCollapsed" class="gl-p-7 gl-text-center collapsed-file-warning">
- <p class="gl-mb-8 gl-mt-5">
- {{ $options.i18n.collapsed }}
- </p>
- <gl-button
- class="gl-alert-action gl-mb-5"
- data-testid="expandButton"
- @click="handleToggle"
- >
- {{ $options.i18n.expand }}
- </gl-button>
+ <div v-show="isCollapsed" class="nothing-here-block diff-collapsed">
+ {{ __('This diff is collapsed.') }}
+ <a class="click-to-expand js-click-to-expand" href="#" @click.prevent="handleToggle">{{
+ __('Click to expand it.')
+ }}</a>
</div>
<diff-content
v-show="!isCollapsed && !isFileTooLarge"
diff --git a/app/assets/javascripts/diffs/i18n.js b/app/assets/javascripts/diffs/i18n.js
deleted file mode 100644
index 8b91543587c..00000000000
--- a/app/assets/javascripts/diffs/i18n.js
+++ /dev/null
@@ -1,14 +0,0 @@
-import { __ } from '~/locale';
-
-export const GENERIC_ERROR = __('Something went wrong on our end. Please try again!');
-
-export const DIFF_FILE = {
- blobView: __('You can %{linkStart}view the blob%{linkEnd} instead.'),
- editInFork: __(
- "You're not allowed to %{tag_start}edit%{tag_end} files in this project directly. Please fork this project, make your changes there, and submit a merge request.",
- ),
- fork: __('Fork'),
- cancel: __('Cancel'),
- collapsed: __('This file is collapsed.'),
- expand: __('Expand file'),
-};
diff --git a/changelogs/unreleased/patch-migration.yml b/changelogs/unreleased/patch-migration.yml
new file mode 100644
index 00000000000..6335c041a5a
--- /dev/null
+++ b/changelogs/unreleased/patch-migration.yml
@@ -0,0 +1,5 @@
+---
+title: Fix rollback portion of migration that adds temporary index for container scanning findings
+merge_request: 44593
+author:
+type: fixed
diff --git a/changelogs/unreleased/revert-42465-and-42343.yml b/changelogs/unreleased/revert-42465-and-42343.yml
new file mode 100644
index 00000000000..4c7342c9d0d
--- /dev/null
+++ b/changelogs/unreleased/revert-42465-and-42343.yml
@@ -0,0 +1,5 @@
+---
+title: 'Revert 42465 and 42343: Expanded collapsed diff files'
+merge_request: 43361
+author:
+type: other
diff --git a/changelogs/unreleased/sh-improve-pre-receive-error-ff-merge-message.yml b/changelogs/unreleased/sh-improve-pre-receive-error-ff-merge-message.yml
new file mode 100644
index 00000000000..af77bfcc41c
--- /dev/null
+++ b/changelogs/unreleased/sh-improve-pre-receive-error-ff-merge-message.yml
@@ -0,0 +1,5 @@
+---
+title: Improve merge error when pre-receive hooks fail in fast-forward merge
+merge_request: 44843
+author:
+type: fixed
diff --git a/db/migrate/20200820105408_add_index_to_container_scanning_findings.rb b/db/migrate/20200820105408_add_index_to_container_scanning_findings.rb
index 834e11e3d6e..dd474b57602 100644
--- a/db/migrate/20200820105408_add_index_to_container_scanning_findings.rb
+++ b/db/migrate/20200820105408_add_index_to_container_scanning_findings.rb
@@ -15,6 +15,6 @@ class AddIndexToContainerScanningFindings < ActiveRecord::Migration[6.0]
end
def down
- remove_concurrent_index_by_name(:project_registry, INDEX_NAME)
+ remove_concurrent_index_by_name(:vulnerability_occurrences, INDEX_NAME)
end
end
diff --git a/lib/gitlab/git/pre_receive_error.rb b/lib/gitlab/git/pre_receive_error.rb
index 7a6f27179f0..b84ac656927 100644
--- a/lib/gitlab/git/pre_receive_error.rb
+++ b/lib/gitlab/git/pre_receive_error.rb
@@ -18,13 +18,15 @@ module Gitlab
attr_reader :raw_message
- def initialize(message = '', user_message = '')
+ def initialize(message = '', fallback_message: '')
@raw_message = message
- if user_message.present?
- super(sanitize(user_message))
+ sanitized_msg = sanitize(message)
+
+ if sanitized_msg.present?
+ super(sanitized_msg)
else
- super(sanitize(message))
+ super(fallback_message)
end
end
diff --git a/lib/gitlab/gitaly_client/operation_service.rb b/lib/gitlab/gitaly_client/operation_service.rb
index 513063c60d2..786eb3ca4ae 100644
--- a/lib/gitlab/gitaly_client/operation_service.rb
+++ b/lib/gitlab/gitaly_client/operation_service.rb
@@ -179,7 +179,7 @@ module Gitlab
)
if response.pre_receive_error.present?
- raise Gitlab::Git::PreReceiveError.new(response.pre_receive_error, "GL-HOOK-ERR: pre-receive hook failed.")
+ raise Gitlab::Git::PreReceiveError.new(response.pre_receive_error, fallback_message: "pre-receive hook failed.")
end
Gitlab::Git::OperationService::BranchUpdate.from_gitaly(response.branch_update)
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index f301315746f..68e3e1b26a9 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -10364,9 +10364,6 @@ msgstr ""
msgid "Expand approvers"
msgstr ""
-msgid "Expand file"
-msgstr ""
-
msgid "Expand milestones"
msgstr ""
@@ -25857,9 +25854,6 @@ msgstr ""
msgid "This field is required."
msgstr ""
-msgid "This file is collapsed."
-msgstr ""
-
msgid "This group"
msgstr ""
diff --git a/spec/features/merge_request/user_expands_diff_spec.rb b/spec/features/merge_request/user_expands_diff_spec.rb
index 0e39cce13a1..0340d9ccc3d 100644
--- a/spec/features/merge_request/user_expands_diff_spec.rb
+++ b/spec/features/merge_request/user_expands_diff_spec.rb
@@ -14,11 +14,11 @@ RSpec.describe 'User expands diff', :js do
it 'allows user to expand diff' do
page.within find('[id="19763941ab80e8c09871c0a425f0560d9053bcb3"]') do
- find('[data-testid="expandButton"]').click
+ click_link 'Click to expand it.'
wait_for_requests
- expect(page).not_to have_content('Expand File')
+ expect(page).not_to have_content('Click to expand it.')
expect(page).to have_selector('.code')
end
end
diff --git a/spec/frontend/diffs/components/diff_file_spec.js b/spec/frontend/diffs/components/diff_file_spec.js
index 79f0f6bc327..4f1376e2c73 100644
--- a/spec/frontend/diffs/components/diff_file_spec.js
+++ b/spec/frontend/diffs/components/diff_file_spec.js
@@ -90,8 +90,8 @@ describe('DiffFile', () => {
vm.isCollapsed = true;
vm.$nextTick(() => {
- expect(vm.$el.innerText).toContain('This file is collapsed.');
- expect(vm.$el.querySelector('[data-testid="expandButton"]')).not.toBeFalsy();
+ expect(vm.$el.innerText).toContain('This diff is collapsed');
+ expect(vm.$el.querySelectorAll('.js-click-to-expand').length).toEqual(1);
done();
});
@@ -102,8 +102,8 @@ describe('DiffFile', () => {
vm.isCollapsed = true;
vm.$nextTick(() => {
- expect(vm.$el.innerText).toContain('This file is collapsed.');
- expect(vm.$el.querySelector('[data-testid="expandButton"]')).not.toBeFalsy();
+ expect(vm.$el.innerText).toContain('This diff is collapsed');
+ expect(vm.$el.querySelectorAll('.js-click-to-expand').length).toEqual(1);
done();
});
@@ -121,8 +121,8 @@ describe('DiffFile', () => {
vm.isCollapsed = true;
vm.$nextTick(() => {
- expect(vm.$el.innerText).toContain('This file is collapsed.');
- expect(vm.$el.querySelector('[data-testid="expandButton"]')).not.toBeFalsy();
+ expect(vm.$el.innerText).toContain('This diff is collapsed');
+ expect(vm.$el.querySelectorAll('.js-click-to-expand').length).toEqual(1);
done();
});
@@ -135,7 +135,7 @@ describe('DiffFile', () => {
vm.file.viewer.name = diffViewerModes.renamed;
vm.$nextTick(() => {
- expect(vm.$el.innerText).not.toContain('This file is collapsed.');
+ expect(vm.$el.innerText).not.toContain('This diff is collapsed');
done();
});
@@ -148,7 +148,7 @@ describe('DiffFile', () => {
vm.file.viewer.name = diffViewerModes.mode_changed;
vm.$nextTick(() => {
- expect(vm.$el.innerText).not.toContain('This file is collapsed.');
+ expect(vm.$el.innerText).not.toContain('This diff is collapsed');
done();
});
diff --git a/spec/lib/gitlab/git/pre_receive_error_spec.rb b/spec/lib/gitlab/git/pre_receive_error_spec.rb
index 2ad27361c80..1a10ff56266 100644
--- a/spec/lib/gitlab/git/pre_receive_error_spec.rb
+++ b/spec/lib/gitlab/git/pre_receive_error_spec.rb
@@ -21,13 +21,21 @@ RSpec.describe Gitlab::Git::PreReceiveError do
expect(ex.raw_message).to eq(raw_message)
end
- it 'sanitizes the user message' do
- raw_message = 'Raw message'
- ex = described_class.new(raw_message, "#{prefix} User message")
+ it 'prefers the original message over the fallback' do
+ raw_message = "#{prefix} Hello,\nworld!"
+ ex = described_class.new(raw_message, fallback_message: "User message")
+ expect(ex.message).to eq('Hello,')
expect(ex.raw_message).to eq(raw_message)
- expect(ex.message).to eq('User message')
end
end
+
+ it 'uses the fallback message' do
+ raw_message = 'Hello\n'
+ ex = described_class.new(raw_message, fallback_message: "User message")
+
+ expect(ex.raw_message).to eq(raw_message)
+ expect(ex.message).to eq('User message')
+ end
end
end
diff --git a/spec/services/merge_requests/ff_merge_service_spec.rb b/spec/services/merge_requests/ff_merge_service_spec.rb
index 55856deeaca..5c44af87470 100644
--- a/spec/services/merge_requests/ff_merge_service_spec.rb
+++ b/spec/services/merge_requests/ff_merge_service_spec.rb
@@ -116,7 +116,7 @@ RSpec.describe MergeRequests::FfMergeService do
error_message = 'error message'
raw_message = 'The truth is out there'
- pre_receive_error = Gitlab::Git::PreReceiveError.new(raw_message, "GitLab: #{error_message}")
+ pre_receive_error = Gitlab::Git::PreReceiveError.new(raw_message, fallback_message: error_message)
allow(service).to receive(:repository).and_raise(pre_receive_error)
allow(service).to receive(:execute_hooks)
expect(Gitlab::ErrorTracking).to receive(:track_exception).with(