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
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-01-26 09:07:41 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-01-26 09:07:41 +0300
commit7cd527ffd9cfef1c872faa5377eaccc3df6ef067 (patch)
tree8e4026ef008f30c5fd7b6bbff08aa494700fa706
parent694926dda342630084c55ad7eba1655fa266b161 (diff)
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--Gemfile.checksum3
-rw-r--r--Gemfile.lock2
-rw-r--r--app/models/releases/link.rb3
-rw-r--r--app/views/layouts/header/_default.html.haml4
-rw-r--r--app/views/shared/nav/_sidebar_menu_item.html.haml5
-rw-r--r--doc/api/releases/index.md8
-rw-r--r--doc/api/releases/links.md12
-rw-r--r--doc/user/project/integrations/webhook_events.md2
-rw-r--r--doc/user/project/merge_requests/csv_export.md2
-rw-r--r--lib/api/entities/releases/link.rb2
-rw-r--r--lib/sidebars/menu_item.rb9
-rw-r--r--lib/sidebars/your_work/menus/merge_requests_menu.rb40
-rw-r--r--locale/gitlab.pot8
-rw-r--r--spec/lib/sidebars/your_work/menus/merge_requests_menu_spec.rb47
-rw-r--r--spec/support/shared_contexts/navbar_structure_context.rb5
15 files changed, 121 insertions, 31 deletions
diff --git a/Gemfile.checksum b/Gemfile.checksum
index 58cca932e04..3a64a1d1007 100644
--- a/Gemfile.checksum
+++ b/Gemfile.checksum
@@ -350,8 +350,7 @@
{"name":"multi_json","version":"1.14.1","platform":"ruby","checksum":"d971296c0eacea289d31e4a7ab7ac5eda97262c62bbc8c110de4f5e36425c577"},
{"name":"multi_xml","version":"0.6.0","platform":"ruby","checksum":"d24393cf958adb226db884b976b007914a89c53ad88718e25679d7008823ad52"},
{"name":"multipart-post","version":"2.2.3","platform":"ruby","checksum":"462979de2971b8df33c2ee797fd497731617241f9dcd93960cc3caccb2dd13d8"},
-{"name":"murmurhash3","version":"0.1.6","platform":"java","checksum":"7e8677549a65b454362d8688885a21cca721a22c086d14e874c26c1e213946f0"},
-{"name":"murmurhash3","version":"0.1.6","platform":"ruby","checksum":"c78f06d1636665c92e2b3cc309e31036ca4cb8f47f1cdc080d4f964f4865fceb"},
+{"name":"murmurhash3","version":"0.1.7","platform":"ruby","checksum":"370a2ce2e9ab0711e51554e530b5f63956927a6554a296855f42a1a4a5ed0936"},
{"name":"mustermann","version":"1.1.1","platform":"ruby","checksum":"0a21cfe505869cce9ce17998db5260344e78df81ae857c07a62143fd30299531"},
{"name":"mustermann-grape","version":"1.0.1","platform":"ruby","checksum":"00ce12b3df66be33ec4304aa9108fb9e1a0689f2a136c96b51c104684f5c5436"},
{"name":"nap","version":"1.1.0","platform":"ruby","checksum":"949691660f9d041d75be611bb2a8d2fd559c467537deac241f4097d9b5eea576"},
diff --git a/Gemfile.lock b/Gemfile.lock
index 79fbffa7c74..6d15bde8646 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -925,7 +925,7 @@ GEM
multi_json (1.14.1)
multi_xml (0.6.0)
multipart-post (2.2.3)
- murmurhash3 (0.1.6)
+ murmurhash3 (0.1.7)
mustermann (1.1.1)
ruby2_keywords (~> 0.0.1)
mustermann-grape (1.0.1)
diff --git a/app/models/releases/link.rb b/app/models/releases/link.rb
index 347adbdf96a..e02486fbc5b 100644
--- a/app/models/releases/link.rb
+++ b/app/models/releases/link.rb
@@ -37,6 +37,7 @@ module Releases
url.start_with?(release.project.web_url)
end
+ # `external?` is deprecated in 15.9 and will be removed in 16.0.
def external?
!internal?
end
@@ -44,7 +45,7 @@ module Releases
def hook_attrs
{
id: id,
- external: external?,
+ external: external?, # `external` is deprecated in 15.9 and will be removed in 16.0.
link_type: link_type,
name: name,
url: url
diff --git a/app/views/layouts/header/_default.html.haml b/app/views/layouts/header/_default.html.haml
index 558af352ae9..4cd876e4fc0 100644
--- a/app/views/layouts/header/_default.html.haml
+++ b/app/views/layouts/header/_default.html.haml
@@ -76,12 +76,12 @@
= _('Merge requests')
%li
= link_to assigned_mrs_dashboard_path, class: 'gl-display-flex! gl-align-items-center js-prefetch-document' do
- = _('Assigned to you')
+ = _('Assigned')
= gl_badge_tag({ variant: :neutral, size: :sm }, { class: "js-assigned-mr-count gl-ml-auto" }) do
= user_merge_requests_counts[:assigned]
%li
= link_to reviewer_mrs_dashboard_path, class: 'dashboard-shortcuts-review_requests gl-display-flex! gl-align-items-center js-prefetch-document' do
- = _('Review requests for you')
+ = _('Review requests')
= gl_badge_tag({ variant: :neutral, size: :sm }, { class: "js-reviewer-mr-count gl-ml-auto" }) do
= user_merge_requests_counts[:review_requested]
- if header_link?(:todos)
diff --git a/app/views/shared/nav/_sidebar_menu_item.html.haml b/app/views/shared/nav/_sidebar_menu_item.html.haml
index 5452cd486da..eea36127745 100644
--- a/app/views/shared/nav/_sidebar_menu_item.html.haml
+++ b/app/views/shared/nav/_sidebar_menu_item.html.haml
@@ -1,8 +1,11 @@
= nav_link(**sidebar_menu_item.active_routes, html_options: sidebar_menu_item.nav_link_html_options) do
= link_to sidebar_menu_item.link, **sidebar_menu_item.link_html_options, data: { qa_selector: 'sidebar_menu_item_link', qa_menu_item: sidebar_menu_item.title } do
- %span
+ %span.gl-flex-grow-1
= sidebar_menu_item.title
- if sidebar_menu_item.sprite_icon
= sprite_icon(sidebar_menu_item.sprite_icon, **sidebar_menu_item.sprite_icon_html_options)
+ - if sidebar_menu_item.has_pill?
+ = gl_badge_tag({ size: :sm, variant: :neutral }, { class: "count fly-out-badge gl-ml-3" }) do
+ = number_with_delimiter(sidebar_menu_item.pill_count)
- if sidebar_menu_item.show_hint?
.js-feature-highlight{ **sidebar_menu_item.hint_html_options }
diff --git a/doc/api/releases/index.md b/doc/api/releases/index.md
index 2e44a33cb89..f23f2b36ed0 100644
--- a/doc/api/releases/index.md
+++ b/doc/api/releases/index.md
@@ -158,14 +158,14 @@ Example response:
"id":2,
"name":"awesome-v0.2.msi",
"url":"http://192.168.10.15:3000/msi",
- "external":true,
+ "external":true, // deprecated in GitLab 15.9, will be removed in GitLab 16.0.
"link_type":"other"
},
{
"id":1,
"name":"awesome-v0.2.dmg",
"url":"http://192.168.10.15:3000",
- "external":true,
+ "external":true, // deprecated in GitLab 15.9, will be removed in GitLab 16.0.
"link_type":"other"
}
],
@@ -386,7 +386,7 @@ Example response:
"id":3,
"name":"hoge",
"url":"https://gitlab.example.com/root/awesome-app/-/tags/v0.11.1/binaries/linux-amd64",
- "external":true,
+ "external":true, // deprecated in GitLab 15.9, will be removed in GitLab 16.0.
"link_type":"other"
}
]
@@ -594,7 +594,7 @@ Example response:
"id":3,
"name":"hoge",
"url":"https://gitlab.example.com/root/awesome-app/-/tags/v0.11.1/binaries/linux-amd64",
- "external":true,
+ "external":true, // deprecated in GitLab 15.9, will be removed in GitLab 16.0.
"link_type":"other"
}
],
diff --git a/doc/api/releases/links.md b/doc/api/releases/links.md
index 7135dc6d063..74f6b1c9efa 100644
--- a/doc/api/releases/links.md
+++ b/doc/api/releases/links.md
@@ -40,14 +40,14 @@ Example response:
"id":2,
"name":"awesome-v0.2.msi",
"url":"http://192.168.10.15:3000/msi",
- "external":true,
+ "external":true, // deprecated in GitLab 15.9, will be removed in GitLab 16.0.
"link_type":"other"
},
{
"id":1,
"name":"awesome-v0.2.dmg",
"url":"http://192.168.10.15:3000",
- "external":true,
+ "external":true, // deprecated in GitLab 15.9, will be removed in GitLab 16.0.
"link_type":"other"
}
]
@@ -80,7 +80,7 @@ Example response:
"id":1,
"name":"awesome-v0.2.dmg",
"url":"http://192.168.10.15:3000",
- "external":true,
+ "external":true, // deprecated in GitLab 15.9, will be removed in GitLab 16.0.
"link_type":"other"
}
```
@@ -122,7 +122,7 @@ Example response:
"name":"hellodarwin-amd64",
"url":"https://gitlab.example.com/mynamespace/hello/-/jobs/688/artifacts/raw/bin/hello-darwin-amd64",
"direct_asset_url":"https://gitlab.example.com/mynamespace/hello/-/releases/v1.7.0/downloads/bin/hellodarwin-amd64",
- "external":false,
+ "external":false, // deprecated in GitLab 15.9, will be removed in GitLab 16.0.
"link_type":"other"
}
```
@@ -164,7 +164,7 @@ Example response:
"id":1,
"name":"new name",
"url":"http://192.168.10.15:3000",
- "external":true,
+ "external":true, // deprecated in GitLab 15.9, will be removed in GitLab 16.0.
"link_type":"runbook"
}
```
@@ -196,7 +196,7 @@ Example response:
"id":1,
"name":"new name",
"url":"http://192.168.10.15:3000",
- "external":true,
+ "external":true, // deprecated in GitLab 15.9, will be removed in GitLab 16.0.
"link_type":"other"
}
```
diff --git a/doc/user/project/integrations/webhook_events.md b/doc/user/project/integrations/webhook_events.md
index 0f462ad41b0..53177004888 100644
--- a/doc/user/project/integrations/webhook_events.md
+++ b/doc/user/project/integrations/webhook_events.md
@@ -1784,7 +1784,7 @@ Payload example:
"links": [
{
"id": 1,
- "external": true,
+ "external": true, // deprecated in GitLab 15.9, will be removed in GitLab 16.0.
"link_type": "other",
"name": "Changelog",
"url": "https://example.net/changelog"
diff --git a/doc/user/project/merge_requests/csv_export.md b/doc/user/project/merge_requests/csv_export.md
index 662189c5e40..9028a9411ea 100644
--- a/doc/user/project/merge_requests/csv_export.md
+++ b/doc/user/project/merge_requests/csv_export.md
@@ -14,7 +14,7 @@ To export merge requests to a CSV file:
1. On the top bar, select **Main menu > Projects** and find your project.
1. On the left sidebar, select **Merge requests** .
-1. Add any searches or filters. This can help you keep the size of the CSV file under the 15MB limit. The limit ensures
+1. Add any searches or filters. This can help you keep the size of the CSV file under the 15 MB limit. The limit ensures
the file can be emailed to a variety of email providers.
1. Select **Export as CSV** (**{export}**).
1. Confirm the correct number of merge requests are to be exported.
diff --git a/lib/api/entities/releases/link.rb b/lib/api/entities/releases/link.rb
index abf380e11d5..534510ec7e6 100644
--- a/lib/api/entities/releases/link.rb
+++ b/lib/api/entities/releases/link.rb
@@ -18,7 +18,7 @@ module API
} do |link|
::Releases::LinkPresenter.new(link).direct_asset_url
end
- expose :external?, documentation: { type: 'boolean' }, as: :external
+ expose :external?, documentation: { type: 'boolean' }, as: :external # @deprecated
expose :link_type, documentation: { type: 'string', example: 'other' }
end
end
diff --git a/lib/sidebars/menu_item.rb b/lib/sidebars/menu_item.rb
index 7ed3e47ae34..efdedf6c3bd 100644
--- a/lib/sidebars/menu_item.rb
+++ b/lib/sidebars/menu_item.rb
@@ -4,9 +4,11 @@ module Sidebars
class MenuItem
include ::Sidebars::Concerns::LinkWithHtmlOptions
- attr_reader :title, :link, :active_routes, :item_id, :container_html_options, :sprite_icon, :sprite_icon_html_options, :hint_html_options
+ attr_reader :title, :link, :active_routes, :item_id, :container_html_options, :sprite_icon, :sprite_icon_html_options, :hint_html_options, :has_pill, :pill_count
+ alias_method :has_pill?, :has_pill
- def initialize(title:, link:, active_routes:, item_id: nil, container_html_options: {}, sprite_icon: nil, sprite_icon_html_options: {}, hint_html_options: {})
+ # rubocop: disable Metrics/ParameterLists
+ def initialize(title:, link:, active_routes:, item_id: nil, container_html_options: {}, sprite_icon: nil, sprite_icon_html_options: {}, hint_html_options: {}, has_pill: false, pill_count: nil)
@title = title
@link = link
@active_routes = active_routes
@@ -15,7 +17,10 @@ module Sidebars
@sprite_icon = sprite_icon
@sprite_icon_html_options = sprite_icon_html_options
@hint_html_options = hint_html_options
+ @has_pill = has_pill
+ @pill_count = pill_count
end
+ # rubocop: enable Metrics/ParameterLists
def show_hint?
hint_html_options.present?
diff --git a/lib/sidebars/your_work/menus/merge_requests_menu.rb b/lib/sidebars/your_work/menus/merge_requests_menu.rb
index 695c2ffdf46..89471638dd2 100644
--- a/lib/sidebars/your_work/menus/merge_requests_menu.rb
+++ b/lib/sidebars/your_work/menus/merge_requests_menu.rb
@@ -4,7 +4,8 @@ module Sidebars
module YourWork
module Menus
class MergeRequestsMenu < ::Sidebars::Menu
- include Gitlab::Utils::StrongMemoize
+ include IssuablesHelper
+ include MergeRequestsHelper
override :link
def link
@@ -21,6 +22,14 @@ module Sidebars
'merge-request'
end
+ override :configure_menu_items
+ def configure_menu_items
+ add_item(assigned_mrs_menu_item)
+ add_item(reviewer_mrs_menu_item)
+
+ true
+ end
+
override :render?
def render?
!!context.current_user
@@ -38,9 +47,34 @@ module Sidebars
override :pill_count
def pill_count
- context.current_user.assigned_open_merge_requests_count
+ user_merge_requests_counts[:total]
+ end
+
+ private
+
+ def assigned_mrs_menu_item
+ link = merge_requests_dashboard_path(assignee_username: context.current_user.username)
+
+ ::Sidebars::MenuItem.new(
+ title: _('Assigned'),
+ link: link,
+ active_routes: { page: link },
+ has_pill: true,
+ pill_count: user_merge_requests_counts[:assigned]
+ )
+ end
+
+ def reviewer_mrs_menu_item
+ link = merge_requests_dashboard_path(reviewer_username: context.current_user.username)
+
+ ::Sidebars::MenuItem.new(
+ title: _('Review requests'),
+ link: link,
+ active_routes: { page: link },
+ has_pill: true,
+ pill_count: user_merge_requests_counts[:review_requested]
+ )
end
- strong_memoize_attr :pill_count
end
end
end
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index 73615e02f54..41b6a377cc3 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -5502,6 +5502,9 @@ msgstr ""
msgid "Assign to me"
msgstr ""
+msgid "Assigned"
+msgstr ""
+
msgid "Assigned %{assignee_users_sentence}."
msgstr ""
@@ -5526,9 +5529,6 @@ msgstr ""
msgid "Assigned to me"
msgstr ""
-msgid "Assigned to you"
-msgstr ""
-
msgid "Assignee"
msgid_plural "%d Assignees"
msgstr[0] ""
@@ -36156,7 +36156,7 @@ msgstr ""
msgid "Review changes"
msgstr ""
-msgid "Review requests for you"
+msgid "Review requests"
msgstr ""
msgid "Review the changes locally."
diff --git a/spec/lib/sidebars/your_work/menus/merge_requests_menu_spec.rb b/spec/lib/sidebars/your_work/menus/merge_requests_menu_spec.rb
index b3251a54178..8941c11006e 100644
--- a/spec/lib/sidebars/your_work/menus/merge_requests_menu_spec.rb
+++ b/spec/lib/sidebars/your_work/menus/merge_requests_menu_spec.rb
@@ -3,10 +3,55 @@
require 'spec_helper'
RSpec.describe Sidebars::YourWork::Menus::MergeRequestsMenu, feature_category: :navigation do
- let(:user) { create(:user) }
+ let_it_be(:user) { create(:user) }
+
let(:context) { Sidebars::Context.new(current_user: user, container: nil) }
subject { described_class.new(context) }
include_examples 'menu item shows pill based on count', :assigned_open_merge_requests_count
+
+ describe 'submenu items' do
+ using RSpec::Parameterized::TableSyntax
+
+ where(:order, :title, :key) do
+ 0 | 'Assigned' | :assigned
+ 1 | 'Review requests' | :review_requested
+ end
+
+ with_them do
+ let(:item) { subject.renderable_items[order] }
+
+ it 'renders items in the right order' do
+ expect(item.title).to eq title
+ end
+
+ context 'when there are no MR counts' do
+ before do
+ allow(user).to receive(:assigned_open_merge_requests_count).and_return(0)
+ allow(user).to receive(:review_requested_open_merge_requests_count).and_return(0)
+ end
+
+ it 'shows a pill even though count is zero' do
+ expect(item.has_pill?).to eq true
+ expect(item.pill_count).to eq 0
+ end
+ end
+
+ context 'when there are MR counts' do
+ let(:non_zero_counts) { { assigned: 2, review_requested: 3 } }
+
+ before do
+ allow(user).to receive(:assigned_open_merge_requests_count).and_return(non_zero_counts[:assigned])
+ allow(user).to receive(:review_requested_open_merge_requests_count)
+ .and_return(non_zero_counts[:review_requested])
+ end
+
+ it 'shows a pill with the correct count' do
+ expect(item.has_pill?).to eq true
+ expect(item.pill_count).to eq non_zero_counts[key]
+ end
+ end
+ end
+ end
end
diff --git a/spec/support/shared_contexts/navbar_structure_context.rb b/spec/support/shared_contexts/navbar_structure_context.rb
index 9c7cf831241..08da55162b4 100644
--- a/spec/support/shared_contexts/navbar_structure_context.rb
+++ b/spec/support/shared_contexts/navbar_structure_context.rb
@@ -243,7 +243,10 @@ RSpec.shared_context 'dashboard navbar structure' do
},
{
nav_item: _("Merge requests"),
- nav_sub_items: []
+ nav_sub_items: [
+ _('Assigned 0'),
+ _('Review requests 0')
+ ]
},
{
nav_item: _("To-Do List"),