From ccf37fd3eca15cd5f55c1eba3b28d2798808d357 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 18 Dec 2019 15:08:03 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- .eslintrc.yml | 1 - app/assets/javascripts/notes.js | 3 +- app/assets/javascripts/notifications_dropdown.js | 4 +- app/assets/javascripts/notifications_form.js | 2 +- app/assets/javascripts/snippets/components/app.vue | 7 +- .../snippets/components/snippet_title.vue | 35 ++++++++++ app/assets/javascripts/tree.js | 4 +- doc/development/architecture.md | 2 +- doc/development/i18n/proofreader.md | 1 + .../img/custom_notifications_dropdown_v12_5.png | Bin 0 -> 30218 bytes .../img/custom_notifications_new_release_v12_4.png | Bin 65959 -> 0 bytes .../img/custom_notifications_new_release_v12_5.png | Bin 0 -> 46129 bytes doc/user/project/releases/img/new_tag_12_5.png | Bin 42439 -> 41120 bytes doc/user/project/releases/img/tags_12_5.png | Bin 44666 -> 31541 bytes doc/user/project/releases/index.md | 23 ++++--- lib/gitlab/git.rb | 1 + lib/gitlab/sidekiq_logging/structured_logger.rb | 2 +- .../create_project_with_auto_devops_spec.rb | 3 +- .../snippets/components/snippet_title_spec.js | 72 +++++++++++++++++++++ spec/lib/gitlab/git_spec.rb | 3 +- .../sidekiq_logging/structured_logger_spec.rb | 10 +-- spec/models/commit_spec.rb | 14 ++++ 22 files changed, 162 insertions(+), 25 deletions(-) create mode 100644 app/assets/javascripts/snippets/components/snippet_title.vue create mode 100644 doc/user/project/releases/img/custom_notifications_dropdown_v12_5.png delete mode 100644 doc/user/project/releases/img/custom_notifications_new_release_v12_4.png create mode 100644 doc/user/project/releases/img/custom_notifications_new_release_v12_5.png create mode 100644 spec/frontend/snippets/components/snippet_title_spec.js diff --git a/.eslintrc.yml b/.eslintrc.yml index 3c304e957b4..15e02a41bee 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -51,7 +51,6 @@ rules: no-jquery/no-animate-toggle: off no-jquery/no-event-shorthand: off no-jquery/no-serialize: error - no-jquery/no-sizzle: off promise/always-return: off promise/no-callback-in-promise: off overrides: diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js index 1a8f1c659a4..4195ea6425f 100644 --- a/app/assets/javascripts/notes.js +++ b/app/assets/javascripts/notes.js @@ -1359,7 +1359,8 @@ export default class Notes { const $systemNote = $(systemNote); const headerMessage = $systemNote .find('.note-text') - .find('p:first') + .find('p') + .first() .text() .replace(':', ''); diff --git a/app/assets/javascripts/notifications_dropdown.js b/app/assets/javascripts/notifications_dropdown.js index 08545dcea46..ab87b0d973c 100644 --- a/app/assets/javascripts/notifications_dropdown.js +++ b/app/assets/javascripts/notifications_dropdown.js @@ -11,7 +11,9 @@ export default function notificationsDropdown() { } const notificationLevel = $(this).data('notificationLevel'); - const form = $(this).parents('.notification-form:first'); + const form = $(this) + .parents('.notification-form') + .first(); form.find('.js-notification-loading').toggleClass('fa-bell fa-spin fa-spinner'); if (form.hasClass('no-label')) { diff --git a/app/assets/javascripts/notifications_form.js b/app/assets/javascripts/notifications_form.js index 45f033f2822..dcd226795a6 100644 --- a/app/assets/javascripts/notifications_form.js +++ b/app/assets/javascripts/notifications_form.js @@ -31,7 +31,7 @@ export default class NotificationsForm { } saveEvent($checkbox, $parent) { - const form = $parent.parents('form:first'); + const form = $parent.parents('form').first(); this.showCheckboxLoadingSpinner($parent); diff --git a/app/assets/javascripts/snippets/components/app.vue b/app/assets/javascripts/snippets/components/app.vue index bd2cb8e4595..7a2145a800c 100644 --- a/app/assets/javascripts/snippets/components/app.vue +++ b/app/assets/javascripts/snippets/components/app.vue @@ -1,11 +1,13 @@ + diff --git a/app/assets/javascripts/tree.js b/app/assets/javascripts/tree.js index a530c4a99e2..59276ee79d8 100644 --- a/app/assets/javascripts/tree.js +++ b/app/assets/javascripts/tree.js @@ -21,7 +21,9 @@ export default class TreeView { } }); // Show the "Loading commit data" for only the first element - $('span.log_loading:first').removeClass('hide'); + $('span.log_loading') + .first() + .removeClass('hide'); } initKeyNav() { diff --git a/doc/development/architecture.md b/doc/development/architecture.md index eff83da523b..778cc1aa1d7 100644 --- a/doc/development/architecture.md +++ b/doc/development/architecture.md @@ -625,7 +625,7 @@ Note: It is recommended to log into the `git` user using `sudo -i -u git` or `su ## GitLab.com -We've also detailed [our architecture of GitLab.com](https://about.gitlab.com/handbook/engineering/infrastructure/production-architecture/) but this is probably over the top unless you have millions of users. +We've also detailed [our architecture of GitLab.com](https://about.gitlab.com/handbook/engineering/infrastructure/production/architecture/) but this is probably over the top unless you have millions of users. [alertmanager-omnibus]: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-config-template/gitlab.rb.template [alertmanager-charts]: https://github.com/helm/charts/tree/master/stable/prometheus diff --git a/doc/development/i18n/proofreader.md b/doc/development/i18n/proofreader.md index 8b3a5d893fe..11fb4b0b9be 100644 --- a/doc/development/i18n/proofreader.md +++ b/doc/development/i18n/proofreader.md @@ -58,6 +58,7 @@ are very appreciative of the work done by translators and proofreaders! - Japanese - Hiroyuki Sato - [GitLab](https://gitlab.com/hiroponz), [Crowdin](https://crowdin.com/profile/hiroponz) - Tomo Dote - [GitLab](https://gitlab.com/fu7mu4), [Crowdin](https://crowdin.com/profile/fu7mu4) + - Hiromi Nozawa - [GitLab](https://gitlab.com/hir0mi), [Crowdin](https://crowdin.com/profile/hir0mi) - Korean - Chang-Ho Cha - [GitLab](https://gitlab.com/changho-cha), [Crowdin](https://crowdin.com/profile/zzazang) - Ji Hun Oh - [GitLab](https://gitlab.com/Baw-Appie), [Crowdin](https://crowdin.com/profile/BawAppie) diff --git a/doc/user/project/releases/img/custom_notifications_dropdown_v12_5.png b/doc/user/project/releases/img/custom_notifications_dropdown_v12_5.png new file mode 100644 index 00000000000..0d5a8807d4a Binary files /dev/null and b/doc/user/project/releases/img/custom_notifications_dropdown_v12_5.png differ diff --git a/doc/user/project/releases/img/custom_notifications_new_release_v12_4.png b/doc/user/project/releases/img/custom_notifications_new_release_v12_4.png deleted file mode 100644 index 6b4231d5804..00000000000 Binary files a/doc/user/project/releases/img/custom_notifications_new_release_v12_4.png and /dev/null differ diff --git a/doc/user/project/releases/img/custom_notifications_new_release_v12_5.png b/doc/user/project/releases/img/custom_notifications_new_release_v12_5.png new file mode 100644 index 00000000000..61af62ca460 Binary files /dev/null and b/doc/user/project/releases/img/custom_notifications_new_release_v12_5.png differ diff --git a/doc/user/project/releases/img/new_tag_12_5.png b/doc/user/project/releases/img/new_tag_12_5.png index 6137ad2ee56..9a6145d71c7 100644 Binary files a/doc/user/project/releases/img/new_tag_12_5.png and b/doc/user/project/releases/img/new_tag_12_5.png differ diff --git a/doc/user/project/releases/img/tags_12_5.png b/doc/user/project/releases/img/tags_12_5.png index 4c032f96125..c9673a5232d 100644 Binary files a/doc/user/project/releases/img/tags_12_5.png and b/doc/user/project/releases/img/tags_12_5.png differ diff --git a/doc/user/project/releases/index.md b/doc/user/project/releases/index.md index 58e028c89be..b5c4ad76fb9 100644 --- a/doc/user/project/releases/index.md +++ b/doc/user/project/releases/index.md @@ -6,7 +6,7 @@ type: reference, howto > [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/issues/41766) in GitLab 11.7. -It's typical to create a [Git tag](../../../university/training/topics/tags.md) at +It is typical to create a [Git tag](../../../university/training/topics/tags.md) at the moment of release to introduce a checkpoint in your source code history, but in most cases your users will need compiled objects or other assets output by your CI system to use them, not just the raw source @@ -38,7 +38,7 @@ Release descriptions are unrelated. Description supports [Markdown](../../markdo You can currently add the following types of assets to each Release: -- [Source code](#source-code): state of the repo at the time of the Release +- [Source code](#source-code): state of the repository at the time of the Release - [Links](#links): to content such as built binaries or documentation GitLab will support more asset types in the future, including objects such @@ -117,11 +117,14 @@ of GitLab. You can be notified by email when a new Release is created for your project. -To subscribe to these notifications, navigate to your **Project**'s landing page, then click on the -bell icon. Choose **Custom** from the dropdown menu. The -following modal window will be then displayed, from which you can select **New release** to complete your subscription to new Releases notifications. +To subscribe to Release notifications: -![Custom notification - New release](img/custom_notifications_new_release_v12_4.png) +1. Navigate to your **Project**'s landing page. +1. Click the bell icon (**Notification setting**). +1. Select **Custom** from the dropdown menu. + ![Custom notification - Dropdown menu](img/custom_notifications_dropdown_v12_5.png) +1. Select **New release**. + ![Custom notification - New release](img/custom_notifications_new_release_v12_5.png) ## Add release notes to Git tags @@ -145,7 +148,7 @@ You can also edit an existing tag to add release notes: ![tags](img/tags_12_5.png "Addition of note to an existing tag") -## Release Evidence +## Release evidence > [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/26019) in GitLab 12.6. @@ -154,11 +157,11 @@ parallel. This dataset will be a snapshot this new release (including linked milestones and issues) at moment of creation. Such collection of data will provide a chain of custody and facilitate processes like external audits, for example. -The gathered Evidence data is stored in the database upon creation of a new +The gathered evidence data is stored in the database upon creation of a new release as a JSON object. In GitLab 12.6, a link to -the Evidence data is provided for [each Release](#releases-list). +the evidence data is provided for [each Release](#releases-list). -Here's what this object can look like: +Here is what this object can look like: ```json { diff --git a/lib/gitlab/git.rb b/lib/gitlab/git.rb index 8d13c74dca2..c58fb1d0be3 100644 --- a/lib/gitlab/git.rb +++ b/lib/gitlab/git.rb @@ -88,6 +88,7 @@ module Gitlab end def shas_eql?(sha1, sha2) + return true if sha1.nil? && sha2.nil? return false if sha1.nil? || sha2.nil? return false unless sha1.class == sha2.class diff --git a/lib/gitlab/sidekiq_logging/structured_logger.rb b/lib/gitlab/sidekiq_logging/structured_logger.rb index ca9e3b8428c..bcc2e77714d 100644 --- a/lib/gitlab/sidekiq_logging/structured_logger.rb +++ b/lib/gitlab/sidekiq_logging/structured_logger.rb @@ -117,7 +117,7 @@ module Gitlab def format_time(timestamp) return timestamp if timestamp.is_a?(String) - Time.at(timestamp).utc.iso8601(6) + Time.at(timestamp).utc.iso8601(3) end def limited_job_args(args) diff --git a/qa/qa/specs/features/browser_ui/7_configure/auto_devops/create_project_with_auto_devops_spec.rb b/qa/qa/specs/features/browser_ui/7_configure/auto_devops/create_project_with_auto_devops_spec.rb index a96bfde49f3..54014ff7067 100644 --- a/qa/qa/specs/features/browser_ui/7_configure/auto_devops/create_project_with_auto_devops_spec.rb +++ b/qa/qa/specs/features/browser_ui/7_configure/auto_devops/create_project_with_auto_devops_spec.rb @@ -50,7 +50,8 @@ module QA end end - describe 'Auto DevOps support', :orchestrated, :kubernetes do + # Failure issue: https://gitlab.com/gitlab-org/gitlab/issues/118481 + describe 'Auto DevOps support', :orchestrated, :kubernetes, :quarantine do context 'when rbac is enabled' do before(:all) do @cluster = Service::KubernetesCluster.new.create! diff --git a/spec/frontend/snippets/components/snippet_title_spec.js b/spec/frontend/snippets/components/snippet_title_spec.js new file mode 100644 index 00000000000..fb2193b26b0 --- /dev/null +++ b/spec/frontend/snippets/components/snippet_title_spec.js @@ -0,0 +1,72 @@ +import SnippetTitle from '~/snippets/components/snippet_title.vue'; +import { GlSprintf } from '@gitlab/ui'; +import { shallowMount } from '@vue/test-utils'; + +describe('Snippet header component', () => { + let wrapper; + const title = 'The property of Thor'; + const description = 'Do not touch this hammer'; + const snippet = { + snippet: { + title, + description, + }, + }; + + function createComponent({ props = snippet } = {}) { + const defaultProps = Object.assign({}, props); + + wrapper = shallowMount(SnippetTitle, { + sync: false, + propsData: { + ...defaultProps, + }, + }); + } + + afterEach(() => { + wrapper.destroy(); + }); + + it('renders itself', () => { + createComponent(); + expect(wrapper.find('.snippet-header').exists()).toBe(true); + }); + + it('renders snippets title and description', () => { + createComponent(); + expect(wrapper.text().trim()).toContain(title); + expect(wrapper.text().trim()).toContain(description); + }); + + it('does not render recent changes time stamp if there were no updates', () => { + createComponent(); + expect(wrapper.find(GlSprintf).exists()).toBe(false); + }); + + it('does not render recent changes time stamp if the time for creation and updates match', () => { + const props = Object.assign(snippet, { + snippet: { + ...snippet.snippet, + createdAt: '2019-12-16T21:45:36Z', + updatedAt: '2019-12-16T21:45:36Z', + }, + }); + createComponent({ props }); + + expect(wrapper.find(GlSprintf).exists()).toBe(false); + }); + + it('renders translated string with most recent changes timestamp if changes were made', () => { + const props = Object.assign(snippet, { + snippet: { + ...snippet.snippet, + createdAt: '2019-12-16T21:45:36Z', + updatedAt: '2019-15-16T21:45:36Z', + }, + }); + createComponent({ props }); + + expect(wrapper.find(GlSprintf).exists()).toBe(true); + }); +}); diff --git a/spec/lib/gitlab/git_spec.rb b/spec/lib/gitlab/git_spec.rb index fbc49e05c37..cb07bbdbaaa 100644 --- a/spec/lib/gitlab/git_spec.rb +++ b/spec/lib/gitlab/git_spec.rb @@ -73,7 +73,8 @@ describe Gitlab::Git do [sha, short_sha, true], [sha, sha.reverse, false], [sha, too_short_sha, false], - [sha, nil, false] + [sha, nil, false], + [nil, nil, true] ] end diff --git a/spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb b/spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb index cb870cc996b..772b0168a2a 100644 --- a/spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb +++ b/spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb @@ -4,7 +4,7 @@ require 'fast_spec_helper' describe Gitlab::SidekiqLogging::StructuredLogger do describe '#call' do - let(:timestamp) { Time.iso8601('2018-01-01T12:00:00Z') } + let(:timestamp) { Time.iso8601('2018-01-01T12:00:00.000Z') } let(:created_at) { timestamp - 1.second } let(:scheduling_latency_s) { 1.0 } @@ -30,8 +30,8 @@ describe Gitlab::SidekiqLogging::StructuredLogger do 'message' => 'TestWorker JID-da883554ee4fe414012f5f42: start', 'job_status' => 'start', 'pid' => Process.pid, - 'created_at' => created_at.iso8601(6), - 'enqueued_at' => created_at.iso8601(6), + 'created_at' => created_at.iso8601(3), + 'enqueued_at' => created_at.iso8601(3), 'scheduling_latency_s' => scheduling_latency_s ) end @@ -40,7 +40,7 @@ describe Gitlab::SidekiqLogging::StructuredLogger do 'message' => 'TestWorker JID-da883554ee4fe414012f5f42: done: 0.0 sec', 'job_status' => 'done', 'duration' => 0.0, - "completed_at" => timestamp.iso8601(6), + "completed_at" => timestamp.iso8601(3), "cpu_s" => 1.111112 ) end @@ -145,7 +145,7 @@ describe Gitlab::SidekiqLogging::StructuredLogger do end context 'with latency' do - let(:created_at) { Time.iso8601('2018-01-01T10:00:00Z') } + let(:created_at) { Time.iso8601('2018-01-01T10:00:00.000Z') } let(:scheduling_latency_s) { 7200.0 } it 'logs with scheduling latency' do diff --git a/spec/models/commit_spec.rb b/spec/models/commit_spec.rb index 1c1b550c69b..930ec889206 100644 --- a/spec/models/commit_spec.rb +++ b/spec/models/commit_spec.rb @@ -63,6 +63,20 @@ describe Commit do end end + describe '#diff_refs' do + it 'is equal to itself' do + expect(commit.diff_refs).to eq(commit.diff_refs) + end + + context 'from a factory' do + let(:commit) { create(:commit) } + + it 'is equal to itself' do + expect(commit.diff_refs).to eq(commit.diff_refs) + end + end + end + describe '#author', :request_store do it 'looks up the author in a case-insensitive way' do user = create(:user, email: commit.author_email.upcase) -- cgit v1.2.3