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>2021-04-21 15:09:16 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-04-21 15:09:16 +0300
commit2af44d609eb8a1579169f9a350bc531d1081d77f (patch)
treea0c23e255fd3fd1a8543910228c98710d40afdbd /app
parentd89b82481b3ee5a226bab905555dd9c6a4708521 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/notebook/cells/markdown.vue35
-rw-r--r--app/finders/users_with_pending_todos_finder.rb16
-rw-r--r--app/models/concerns/sidebars/container_with_html_options.rb42
-rw-r--r--app/models/concerns/sidebars/has_active_routes.rb16
-rw-r--r--app/models/concerns/sidebars/has_hint.rb16
-rw-r--r--app/models/concerns/sidebars/has_icon.rb27
-rw-r--r--app/models/concerns/sidebars/has_pill.rb21
-rw-r--r--app/models/concerns/sidebars/positionable_list.rb37
-rw-r--r--app/models/concerns/sidebars/renderable.rb12
-rw-r--r--app/models/group.rb2
-rw-r--r--app/models/sidebars/context.rb21
-rw-r--r--app/models/sidebars/menu.rb82
-rw-r--r--app/models/sidebars/menu_item.rb21
-rw-r--r--app/models/sidebars/panel.rb75
-rw-r--r--app/models/sidebars/projects/context.rb11
-rw-r--r--app/models/sidebars/projects/menus/learn_gitlab/menu.rb41
-rw-r--r--app/models/sidebars/projects/menus/project_overview/menu.rb45
-rw-r--r--app/models/sidebars/projects/menus/project_overview/menu_items/activity.rb35
-rw-r--r--app/models/sidebars/projects/menus/project_overview/menu_items/details.rb36
-rw-r--r--app/models/sidebars/projects/menus/project_overview/menu_items/releases.rb40
-rw-r--r--app/models/sidebars/projects/menus/repository/menu.rb59
-rw-r--r--app/models/sidebars/projects/menus/repository/menu_items/branches.rb35
-rw-r--r--app/models/sidebars/projects/menus/repository/menu_items/commits.rb35
-rw-r--r--app/models/sidebars/projects/menus/repository/menu_items/compare.rb28
-rw-r--r--app/models/sidebars/projects/menus/repository/menu_items/contributors.rb28
-rw-r--r--app/models/sidebars/projects/menus/repository/menu_items/files.rb28
-rw-r--r--app/models/sidebars/projects/menus/repository/menu_items/graphs.rb28
-rw-r--r--app/models/sidebars/projects/menus/repository/menu_items/tags.rb28
-rw-r--r--app/models/sidebars/projects/menus/scope/menu.rb21
-rw-r--r--app/models/sidebars/projects/panel.rb26
-rw-r--r--app/models/user.rb2
-rw-r--r--app/services/todo_service.rb2
-rw-r--r--app/views/admin/groups/_group.html.haml2
-rw-r--r--app/views/admin/users/_users.html.haml18
-rw-r--r--app/views/dashboard/todos/index.html.haml4
-rw-r--r--app/views/groups/milestones/_header_title.html.haml2
-rw-r--r--app/views/profiles/preferences/show.html.haml2
37 files changed, 51 insertions, 928 deletions
diff --git a/app/assets/javascripts/notebook/cells/markdown.vue b/app/assets/javascripts/notebook/cells/markdown.vue
index c09db6851e5..9bf26e5a182 100644
--- a/app/assets/javascripts/notebook/cells/markdown.vue
+++ b/app/assets/javascripts/notebook/cells/markdown.vue
@@ -3,6 +3,7 @@
import katex from 'katex';
import marked from 'marked';
import { sanitize } from '~/lib/dompurify';
+import { hasContent } from '~/lib/utils/text_utility';
import Prompt from './prompt.vue';
const renderer = new marked.Renderer();
@@ -88,6 +89,38 @@ renderer.listitem = (t) => {
const [text, inline] = renderKatex(t);
return `<li class="${inline ? 'inline-katex' : ''}">${text}</li>`;
};
+renderer.originalImage = renderer.image;
+
+renderer.image = function image(href, title, text) {
+ const attachmentHeader = `attachment:`; // eslint-disable-line @gitlab/require-i18n-strings
+
+ if (!this.attachments || !href.startsWith(attachmentHeader)) {
+ return this.originalImage(href, title, text);
+ }
+
+ let img = ``;
+ const filename = href.substring(attachmentHeader.length);
+
+ if (hasContent(filename)) {
+ const attachment = this.attachments[filename];
+
+ if (attachment) {
+ const imageType = Object.keys(attachment)[0];
+
+ if (hasContent(imageType)) {
+ const data = attachment[imageType];
+ const inlined = `data:${imageType};base64,${data}"`; // eslint-disable-line @gitlab/require-i18n-strings
+ img = this.originalImage(inlined, title, text);
+ }
+ }
+ }
+
+ if (!hasContent(img)) {
+ return this.originalImage(href, title, text);
+ }
+
+ return sanitize(img);
+};
marked.setOptions({
renderer,
@@ -105,6 +138,8 @@ export default {
},
computed: {
markdown() {
+ renderer.attachments = this.cell.attachments;
+
return sanitize(marked(this.cell.source.join('').replace(/\\/g, '\\\\')), {
// allowedTags from GitLab's inline HTML guidelines
// https://docs.gitlab.com/ee/user/markdown.html#inline-html
diff --git a/app/finders/users_with_pending_todos_finder.rb b/app/finders/users_with_pending_todos_finder.rb
deleted file mode 100644
index 461bd92a366..00000000000
--- a/app/finders/users_with_pending_todos_finder.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-# Finder that given a target (e.g. an issue) finds all the users that have
-# pending todos for said target.
-class UsersWithPendingTodosFinder
- attr_reader :target
-
- # target - The target, such as an Issue or MergeRequest.
- def initialize(target)
- @target = target
- end
-
- def execute
- User.for_todos(target.todos.pending)
- end
-end
diff --git a/app/models/concerns/sidebars/container_with_html_options.rb b/app/models/concerns/sidebars/container_with_html_options.rb
deleted file mode 100644
index 12ea366c66a..00000000000
--- a/app/models/concerns/sidebars/container_with_html_options.rb
+++ /dev/null
@@ -1,42 +0,0 @@
-# frozen_string_literal: true
-
-module Sidebars
- module ContainerWithHtmlOptions
- # The attributes returned from this method
- # will be applied to helper methods like
- # `link_to` or the div containing the container.
- def container_html_options
- {
- aria: { label: title }
- }.merge(extra_container_html_options)
- end
-
- # Classes will override mostly this method
- # and not `container_html_options`.
- def extra_container_html_options
- {}
- end
-
- # Attributes to pass to the html_options attribute
- # in the helper method that sets the active class
- # on each element.
- def nav_link_html_options
- {}
- end
-
- def title
- raise NotImplementedError
- end
-
- # The attributes returned from this method
- # will be applied right next to the title,
- # for example in the span that renders the title.
- def title_html_options
- {}
- end
-
- def link
- raise NotImplementedError
- end
- end
-end
diff --git a/app/models/concerns/sidebars/has_active_routes.rb b/app/models/concerns/sidebars/has_active_routes.rb
deleted file mode 100644
index e7a153f067a..00000000000
--- a/app/models/concerns/sidebars/has_active_routes.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-module Sidebars
- module HasActiveRoutes
- # This method will indicate for which paths or
- # controllers, the menu or menu item should
- # be set as active.
- #
- # The returned values are passed to the `nav_link` helper method,
- # so the params can be either `path`, `page`, `controller`.
- # Param 'action' is not supported.
- def active_routes
- {}
- end
- end
-end
diff --git a/app/models/concerns/sidebars/has_hint.rb b/app/models/concerns/sidebars/has_hint.rb
deleted file mode 100644
index 21dca39dca0..00000000000
--- a/app/models/concerns/sidebars/has_hint.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-# This module has the necessary methods to store
-# hints for menus. Hints are elements displayed
-# when the user hover the menu item.
-module Sidebars
- module HasHint
- def show_hint?
- false
- end
-
- def hint_html_options
- {}
- end
- end
-end
diff --git a/app/models/concerns/sidebars/has_icon.rb b/app/models/concerns/sidebars/has_icon.rb
deleted file mode 100644
index d1a87918285..00000000000
--- a/app/models/concerns/sidebars/has_icon.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-# frozen_string_literal: true
-
-# This module has the necessary methods to show
-# sprites or images next to the menu item.
-module Sidebars
- module HasIcon
- def sprite_icon
- nil
- end
-
- def sprite_icon_html_options
- {}
- end
-
- def image_path
- nil
- end
-
- def image_html_options
- {}
- end
-
- def icon_or_image?
- sprite_icon || image_path
- end
- end
-end
diff --git a/app/models/concerns/sidebars/has_pill.rb b/app/models/concerns/sidebars/has_pill.rb
deleted file mode 100644
index ad7064fe63d..00000000000
--- a/app/models/concerns/sidebars/has_pill.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-# This module introduces the logic to show the "pill" element
-# next to the menu item, indicating the a count.
-module Sidebars
- module HasPill
- def has_pill?
- false
- end
-
- # In this method we will need to provide the query
- # to retrieve the elements count
- def pill_count
- raise NotImplementedError
- end
-
- def pill_html_options
- {}
- end
- end
-end
diff --git a/app/models/concerns/sidebars/positionable_list.rb b/app/models/concerns/sidebars/positionable_list.rb
deleted file mode 100644
index 30830d547f3..00000000000
--- a/app/models/concerns/sidebars/positionable_list.rb
+++ /dev/null
@@ -1,37 +0,0 @@
-# frozen_string_literal: true
-
-# This module handles elements in a list. All elements
-# must have a different class
-module Sidebars
- module PositionableList
- def add_element(list, element)
- list << element
- end
-
- def insert_element_before(list, before_element, new_element)
- index = index_of(list, before_element)
-
- if index
- list.insert(index, new_element)
- else
- list.unshift(new_element)
- end
- end
-
- def insert_element_after(list, after_element, new_element)
- index = index_of(list, after_element)
-
- if index
- list.insert(index + 1, new_element)
- else
- add_element(list, new_element)
- end
- end
-
- private
-
- def index_of(list, element)
- list.index { |e| e.is_a?(element) }
- end
- end
-end
diff --git a/app/models/concerns/sidebars/renderable.rb b/app/models/concerns/sidebars/renderable.rb
deleted file mode 100644
index a3976af8515..00000000000
--- a/app/models/concerns/sidebars/renderable.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-# frozen_string_literal: true
-
-module Sidebars
- module Renderable
- # This method will control whether the menu or menu_item
- # should be rendered. It will be overriden by specific
- # classes.
- def render?
- true
- end
- end
-end
diff --git a/app/models/group.rb b/app/models/group.rb
index 2967c1ffc1d..60a0e27428d 100644
--- a/app/models/group.rb
+++ b/app/models/group.rb
@@ -118,8 +118,6 @@ class Group < Namespace
.where("project_authorizations.user_id IN (?)", user_ids)
end
- delegate :default_branch_name, to: :namespace_settings
-
class << self
def sort_by_attribute(method)
if method == 'storage_size_desc'
diff --git a/app/models/sidebars/context.rb b/app/models/sidebars/context.rb
deleted file mode 100644
index d9ac2705aaf..00000000000
--- a/app/models/sidebars/context.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-# This class stores all the information needed to display and
-# render the sidebar and menus.
-# It usually stores information regarding the context and calculated
-# values where the logic is in helpers.
-module Sidebars
- class Context
- attr_reader :current_user, :container
-
- def initialize(current_user:, container:, **args)
- @current_user = current_user
- @container = container
-
- args.each do |key, value|
- singleton_class.public_send(:attr_reader, key) # rubocop:disable GitlabSecurity/PublicSend
- instance_variable_set("@#{key}", value)
- end
- end
- end
-end
diff --git a/app/models/sidebars/menu.rb b/app/models/sidebars/menu.rb
deleted file mode 100644
index a5c8be2bb31..00000000000
--- a/app/models/sidebars/menu.rb
+++ /dev/null
@@ -1,82 +0,0 @@
-# frozen_string_literal: true
-
-module Sidebars
- class Menu
- extend ::Gitlab::Utils::Override
- include ::Gitlab::Routing
- include GitlabRoutingHelper
- include Gitlab::Allowable
- include ::Sidebars::HasPill
- include ::Sidebars::HasIcon
- include ::Sidebars::PositionableList
- include ::Sidebars::Renderable
- include ::Sidebars::ContainerWithHtmlOptions
- include ::Sidebars::HasActiveRoutes
-
- attr_reader :context
- delegate :current_user, :container, to: :@context
-
- def initialize(context)
- @context = context
- @items = []
-
- configure_menu_items
- end
-
- def configure_menu_items
- # No-op
- end
-
- override :render?
- def render?
- @items.empty? || renderable_items.any?
- end
-
- # Menus might have or not a link
- override :link
- def link
- nil
- end
-
- # This method normalizes the information retrieved from the submenus and this menu
- # Value from menus is something like: [{ path: 'foo', path: 'bar', controller: :foo }]
- # This method filters the information and returns: { path: ['foo', 'bar'], controller: :foo }
- def all_active_routes
- @all_active_routes ||= begin
- ([active_routes] + renderable_items.map(&:active_routes)).flatten.each_with_object({}) do |pairs, hash|
- pairs.each do |k, v|
- hash[k] ||= []
- hash[k] += Array(v)
- hash[k].uniq!
- end
-
- hash
- end
- end
- end
-
- def has_items?
- @items.any?
- end
-
- def add_item(item)
- add_element(@items, item)
- end
-
- def insert_item_before(before_item, new_item)
- insert_element_before(@items, before_item, new_item)
- end
-
- def insert_item_after(after_item, new_item)
- insert_element_after(@items, after_item, new_item)
- end
-
- def has_renderable_items?
- renderable_items.any?
- end
-
- def renderable_items
- @renderable_items ||= @items.select(&:render?)
- end
- end
-end
diff --git a/app/models/sidebars/menu_item.rb b/app/models/sidebars/menu_item.rb
deleted file mode 100644
index 7466b31898e..00000000000
--- a/app/models/sidebars/menu_item.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-module Sidebars
- class MenuItem
- extend ::Gitlab::Utils::Override
- include ::Gitlab::Routing
- include GitlabRoutingHelper
- include Gitlab::Allowable
- include ::Sidebars::HasIcon
- include ::Sidebars::HasHint
- include ::Sidebars::Renderable
- include ::Sidebars::ContainerWithHtmlOptions
- include ::Sidebars::HasActiveRoutes
-
- attr_reader :context
-
- def initialize(context)
- @context = context
- end
- end
-end
diff --git a/app/models/sidebars/panel.rb b/app/models/sidebars/panel.rb
deleted file mode 100644
index 5c8191ebda3..00000000000
--- a/app/models/sidebars/panel.rb
+++ /dev/null
@@ -1,75 +0,0 @@
-# frozen_string_literal: true
-
-module Sidebars
- class Panel
- extend ::Gitlab::Utils::Override
- include ::Sidebars::PositionableList
-
- attr_reader :context, :scope_menu, :hidden_menu
-
- def initialize(context)
- @context = context
- @scope_menu = nil
- @hidden_menu = nil
- @menus = []
-
- configure_menus
- end
-
- def configure_menus
- # No-op
- end
-
- def add_menu(menu)
- add_element(@menus, menu)
- end
-
- def insert_menu_before(before_menu, new_menu)
- insert_element_before(@menus, before_menu, new_menu)
- end
-
- def insert_menu_after(after_menu, new_menu)
- insert_element_after(@menus, after_menu, new_menu)
- end
-
- def set_scope_menu(scope_menu)
- @scope_menu = scope_menu
- end
-
- def set_hidden_menu(hidden_menu)
- @hidden_menu = hidden_menu
- end
-
- def aria_label
- raise NotImplementedError
- end
-
- def has_renderable_menus?
- renderable_menus.any?
- end
-
- def renderable_menus
- @renderable_menus ||= @menus.select(&:render?)
- end
-
- def container
- context.container
- end
-
- # Auxiliar method that helps with the migration from
- # regular views to the new logic
- def render_raw_scope_menu_partial
- # No-op
- end
-
- # Auxiliar method that helps with the migration from
- # regular views to the new logic.
- #
- # Any menu inside this partial will be added after
- # all the menus added in the `configure_menus`
- # method.
- def render_raw_menus_partial
- # No-op
- end
- end
-end
diff --git a/app/models/sidebars/projects/context.rb b/app/models/sidebars/projects/context.rb
deleted file mode 100644
index 4c82309035d..00000000000
--- a/app/models/sidebars/projects/context.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-module Sidebars
- module Projects
- class Context < ::Sidebars::Context
- def initialize(current_user:, container:, **args)
- super(current_user: current_user, container: container, project: container, **args)
- end
- end
- end
-end
diff --git a/app/models/sidebars/projects/menus/learn_gitlab/menu.rb b/app/models/sidebars/projects/menus/learn_gitlab/menu.rb
deleted file mode 100644
index 4b572846d1a..00000000000
--- a/app/models/sidebars/projects/menus/learn_gitlab/menu.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-# frozen_string_literal: true
-
-module Sidebars
- module Projects
- module Menus
- module LearnGitlab
- class Menu < ::Sidebars::Menu
- override :link
- def link
- project_learn_gitlab_path(context.project)
- end
-
- override :active_routes
- def active_routes
- { controller: :learn_gitlab }
- end
-
- override :title
- def title
- _('Learn GitLab')
- end
-
- override :extra_container_html_options
- def nav_link_html_options
- { class: 'home' }
- end
-
- override :sprite_icon
- def sprite_icon
- 'home'
- end
-
- override :render?
- def render?
- context.learn_gitlab_experiment_enabled
- end
- end
- end
- end
- end
-end
diff --git a/app/models/sidebars/projects/menus/project_overview/menu.rb b/app/models/sidebars/projects/menus/project_overview/menu.rb
deleted file mode 100644
index e6aa8ed159f..00000000000
--- a/app/models/sidebars/projects/menus/project_overview/menu.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-# frozen_string_literal: true
-
-module Sidebars
- module Projects
- module Menus
- module ProjectOverview
- class Menu < ::Sidebars::Menu
- override :configure_menu_items
- def configure_menu_items
- add_item(MenuItems::Details.new(context))
- add_item(MenuItems::Activity.new(context))
- add_item(MenuItems::Releases.new(context))
- end
-
- override :link
- def link
- project_path(context.project)
- end
-
- override :extra_container_html_options
- def extra_container_html_options
- {
- class: 'shortcuts-project rspec-project-link'
- }
- end
-
- override :extra_container_html_options
- def nav_link_html_options
- { class: 'home' }
- end
-
- override :title
- def title
- _('Project overview')
- end
-
- override :sprite_icon
- def sprite_icon
- 'home'
- end
- end
- end
- end
- end
-end
diff --git a/app/models/sidebars/projects/menus/project_overview/menu_items/activity.rb b/app/models/sidebars/projects/menus/project_overview/menu_items/activity.rb
deleted file mode 100644
index 46d0f0bc43b..00000000000
--- a/app/models/sidebars/projects/menus/project_overview/menu_items/activity.rb
+++ /dev/null
@@ -1,35 +0,0 @@
-# frozen_string_literal: true
-
-module Sidebars
- module Projects
- module Menus
- module ProjectOverview
- module MenuItems
- class Activity < ::Sidebars::MenuItem
- override :link
- def link
- activity_project_path(context.project)
- end
-
- override :extra_container_html_options
- def extra_container_html_options
- {
- class: 'shortcuts-project-activity'
- }
- end
-
- override :active_routes
- def active_routes
- { path: 'projects#activity' }
- end
-
- override :title
- def title
- _('Activity')
- end
- end
- end
- end
- end
- end
-end
diff --git a/app/models/sidebars/projects/menus/project_overview/menu_items/details.rb b/app/models/sidebars/projects/menus/project_overview/menu_items/details.rb
deleted file mode 100644
index c40c2ed8fa2..00000000000
--- a/app/models/sidebars/projects/menus/project_overview/menu_items/details.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-# frozen_string_literal: true
-
-module Sidebars
- module Projects
- module Menus
- module ProjectOverview
- module MenuItems
- class Details < ::Sidebars::MenuItem
- override :link
- def link
- project_path(context.project)
- end
-
- override :extra_container_html_options
- def extra_container_html_options
- {
- aria: { label: _('Project details') },
- class: 'shortcuts-project'
- }
- end
-
- override :active_routes
- def active_routes
- { path: 'projects#show' }
- end
-
- override :title
- def title
- _('Details')
- end
- end
- end
- end
- end
- end
-end
diff --git a/app/models/sidebars/projects/menus/project_overview/menu_items/releases.rb b/app/models/sidebars/projects/menus/project_overview/menu_items/releases.rb
deleted file mode 100644
index 5e8348f4398..00000000000
--- a/app/models/sidebars/projects/menus/project_overview/menu_items/releases.rb
+++ /dev/null
@@ -1,40 +0,0 @@
-# frozen_string_literal: true
-
-module Sidebars
- module Projects
- module Menus
- module ProjectOverview
- module MenuItems
- class Releases < ::Sidebars::MenuItem
- override :link
- def link
- project_releases_path(context.project)
- end
-
- override :extra_container_html_options
- def extra_container_html_options
- {
- class: 'shortcuts-project-releases'
- }
- end
-
- override :render?
- def render?
- can?(context.current_user, :read_release, context.project) && !context.project.empty_repo?
- end
-
- override :active_routes
- def active_routes
- { controller: :releases }
- end
-
- override :title
- def title
- _('Releases')
- end
- end
- end
- end
- end
- end
-end
diff --git a/app/models/sidebars/projects/menus/repository/menu.rb b/app/models/sidebars/projects/menus/repository/menu.rb
deleted file mode 100644
index f49a0479521..00000000000
--- a/app/models/sidebars/projects/menus/repository/menu.rb
+++ /dev/null
@@ -1,59 +0,0 @@
-# frozen_string_literal: true
-
-module Sidebars
- module Projects
- module Menus
- module Repository
- class Menu < ::Sidebars::Menu
- override :configure_menu_items
- def configure_menu_items
- add_item(MenuItems::Files.new(context))
- add_item(MenuItems::Commits.new(context))
- add_item(MenuItems::Branches.new(context))
- add_item(MenuItems::Tags.new(context))
- add_item(MenuItems::Contributors.new(context))
- add_item(MenuItems::Graphs.new(context))
- add_item(MenuItems::Compare.new(context))
- end
-
- override :link
- def link
- project_tree_path(context.project)
- end
-
- override :extra_container_html_options
- def extra_container_html_options
- {
- class: 'shortcuts-tree'
- }
- end
-
- override :title
- def title
- _('Repository')
- end
-
- override :title_html_options
- def title_html_options
- {
- id: 'js-onboarding-repo-link'
- }
- end
-
- override :sprite_icon
- def sprite_icon
- 'doc-text'
- end
-
- override :render?
- def render?
- can?(context.current_user, :download_code, context.project) &&
- !context.project.empty_repo?
- end
- end
- end
- end
- end
-end
-
-Sidebars::Projects::Menus::Repository::Menu.prepend_if_ee('EE::Sidebars::Projects::Menus::Repository::Menu')
diff --git a/app/models/sidebars/projects/menus/repository/menu_items/branches.rb b/app/models/sidebars/projects/menus/repository/menu_items/branches.rb
deleted file mode 100644
index 4a62803dd2b..00000000000
--- a/app/models/sidebars/projects/menus/repository/menu_items/branches.rb
+++ /dev/null
@@ -1,35 +0,0 @@
-# frozen_string_literal: true
-
-module Sidebars
- module Projects
- module Menus
- module Repository
- module MenuItems
- class Branches < ::Sidebars::MenuItem
- override :link
- def link
- project_branches_path(context.project)
- end
-
- override :extra_container_html_options
- def extra_container_html_options
- {
- id: 'js-onboarding-branches-link'
- }
- end
-
- override :active_routes
- def active_routes
- { controller: :branches }
- end
-
- override :title
- def title
- _('Branches')
- end
- end
- end
- end
- end
- end
-end
diff --git a/app/models/sidebars/projects/menus/repository/menu_items/commits.rb b/app/models/sidebars/projects/menus/repository/menu_items/commits.rb
deleted file mode 100644
index 647cf89133e..00000000000
--- a/app/models/sidebars/projects/menus/repository/menu_items/commits.rb
+++ /dev/null
@@ -1,35 +0,0 @@
-# frozen_string_literal: true
-
-module Sidebars
- module Projects
- module Menus
- module Repository
- module MenuItems
- class Commits < ::Sidebars::MenuItem
- override :link
- def link
- project_commits_path(context.project, context.current_ref)
- end
-
- override :extra_container_html_options
- def extra_container_html_options
- {
- id: 'js-onboarding-commits-link'
- }
- end
-
- override :active_routes
- def active_routes
- { controller: %w(commit commits) }
- end
-
- override :title
- def title
- _('Commits')
- end
- end
- end
- end
- end
- end
-end
diff --git a/app/models/sidebars/projects/menus/repository/menu_items/compare.rb b/app/models/sidebars/projects/menus/repository/menu_items/compare.rb
deleted file mode 100644
index 4812636b63f..00000000000
--- a/app/models/sidebars/projects/menus/repository/menu_items/compare.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-# frozen_string_literal: true
-
-module Sidebars
- module Projects
- module Menus
- module Repository
- module MenuItems
- class Compare < ::Sidebars::MenuItem
- override :link
- def link
- project_compare_index_path(context.project, from: context.project.repository.root_ref, to: context.current_ref)
- end
-
- override :active_routes
- def active_routes
- { controller: :compare }
- end
-
- override :title
- def title
- _('Compare')
- end
- end
- end
- end
- end
- end
-end
diff --git a/app/models/sidebars/projects/menus/repository/menu_items/contributors.rb b/app/models/sidebars/projects/menus/repository/menu_items/contributors.rb
deleted file mode 100644
index d60fd05bb64..00000000000
--- a/app/models/sidebars/projects/menus/repository/menu_items/contributors.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-# frozen_string_literal: true
-
-module Sidebars
- module Projects
- module Menus
- module Repository
- module MenuItems
- class Contributors < ::Sidebars::MenuItem
- override :link
- def link
- project_graph_path(context.project, context.current_ref)
- end
-
- override :active_routes
- def active_routes
- { path: 'graphs#show' }
- end
-
- override :title
- def title
- _('Contributors')
- end
- end
- end
- end
- end
- end
-end
diff --git a/app/models/sidebars/projects/menus/repository/menu_items/files.rb b/app/models/sidebars/projects/menus/repository/menu_items/files.rb
deleted file mode 100644
index 4989efe9fa5..00000000000
--- a/app/models/sidebars/projects/menus/repository/menu_items/files.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-# frozen_string_literal: true
-
-module Sidebars
- module Projects
- module Menus
- module Repository
- module MenuItems
- class Files < ::Sidebars::MenuItem
- override :link
- def link
- project_tree_path(context.project, context.current_ref)
- end
-
- override :active_routes
- def active_routes
- { controller: %w[tree blob blame edit_tree new_tree find_file] }
- end
-
- override :title
- def title
- _('Files')
- end
- end
- end
- end
- end
- end
-end
diff --git a/app/models/sidebars/projects/menus/repository/menu_items/graphs.rb b/app/models/sidebars/projects/menus/repository/menu_items/graphs.rb
deleted file mode 100644
index a57021be4d0..00000000000
--- a/app/models/sidebars/projects/menus/repository/menu_items/graphs.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-# frozen_string_literal: true
-
-module Sidebars
- module Projects
- module Menus
- module Repository
- module MenuItems
- class Graphs < ::Sidebars::MenuItem
- override :link
- def link
- project_network_path(context.project, context.current_ref)
- end
-
- override :active_routes
- def active_routes
- { controller: :network }
- end
-
- override :title
- def title
- _('Graph')
- end
- end
- end
- end
- end
- end
-end
diff --git a/app/models/sidebars/projects/menus/repository/menu_items/tags.rb b/app/models/sidebars/projects/menus/repository/menu_items/tags.rb
deleted file mode 100644
index d84bc89b93c..00000000000
--- a/app/models/sidebars/projects/menus/repository/menu_items/tags.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-# frozen_string_literal: true
-
-module Sidebars
- module Projects
- module Menus
- module Repository
- module MenuItems
- class Tags < ::Sidebars::MenuItem
- override :link
- def link
- project_tags_path(context.project)
- end
-
- override :active_routes
- def active_routes
- { controller: :tags }
- end
-
- override :title
- def title
- _('Tags')
- end
- end
- end
- end
- end
- end
-end
diff --git a/app/models/sidebars/projects/menus/scope/menu.rb b/app/models/sidebars/projects/menus/scope/menu.rb
deleted file mode 100644
index 3b699083f75..00000000000
--- a/app/models/sidebars/projects/menus/scope/menu.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-module Sidebars
- module Projects
- module Menus
- module Scope
- class Menu < ::Sidebars::Menu
- override :link
- def link
- project_path(context.project)
- end
-
- override :title
- def title
- context.project.name
- end
- end
- end
- end
- end
-end
diff --git a/app/models/sidebars/projects/panel.rb b/app/models/sidebars/projects/panel.rb
deleted file mode 100644
index ec4fac53a40..00000000000
--- a/app/models/sidebars/projects/panel.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-# frozen_string_literal: true
-
-module Sidebars
- module Projects
- class Panel < ::Sidebars::Panel
- override :configure_menus
- def configure_menus
- set_scope_menu(Sidebars::Projects::Menus::Scope::Menu.new(context))
-
- add_menu(Sidebars::Projects::Menus::ProjectOverview::Menu.new(context))
- add_menu(Sidebars::Projects::Menus::LearnGitlab::Menu.new(context))
- add_menu(Sidebars::Projects::Menus::Repository::Menu.new(context))
- end
-
- override :render_raw_menus_partial
- def render_raw_menus_partial
- 'layouts/nav/sidebar/project_menus'
- end
-
- override :aria_label
- def aria_label
- _('Project navigation')
- end
- end
- end
-end
diff --git a/app/models/user.rb b/app/models/user.rb
index 4f9874ab94b..92d11d231ec 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -376,7 +376,7 @@ class User < ApplicationRecord
scope :by_name, -> (names) { iwhere(name: Array(names)) }
scope :by_user_email, -> (emails) { iwhere(email: Array(emails)) }
scope :by_emails, -> (emails) { joins(:emails).where(emails: { email: Array(emails).map(&:downcase) }) }
- scope :for_todos, -> (todos) { where(id: todos.select(:user_id)) }
+ scope :for_todos, -> (todos) { where(id: todos.select(:user_id).distinct) }
scope :with_emails, -> { preload(:emails) }
scope :with_dashboard, -> (dashboard) { where(dashboard: dashboard) }
scope :with_public_profile, -> { where(private_profile: false) }
diff --git a/app/services/todo_service.rb b/app/services/todo_service.rb
index e473a6dc594..d3e7d3040af 100644
--- a/app/services/todo_service.rb
+++ b/app/services/todo_service.rb
@@ -43,7 +43,7 @@ class TodoService
# updates the todo counts for those users.
#
def destroy_target(target)
- todo_users = UsersWithPendingTodosFinder.new(target).execute.to_a
+ todo_users = User.for_todos(target.todos).to_a
yield target
diff --git a/app/views/admin/groups/_group.html.haml b/app/views/admin/groups/_group.html.haml
index df7af86e089..bbc65850794 100644
--- a/app/views/admin/groups/_group.html.haml
+++ b/app/views/admin/groups/_group.html.haml
@@ -15,7 +15,7 @@
= markdown_field(group, :description)
.stats.gl-text-gray-500.gl-flex-shrink-0.gl-display-none.gl-sm-display-flex
- %span.badge.badge-pill
+ %span.badge.badge-muted.badge-pill.gl-badge.sm
= storage_counter(group.storage_size)
= render_if_exists 'admin/namespace_plan_badge', namespace: group, css_class: 'gl-ml-5 gl-mr-0'
diff --git a/app/views/admin/users/_users.html.haml b/app/views/admin/users/_users.html.haml
index c79b2e978f2..cd128e39c4f 100644
--- a/app/views/admin/users/_users.html.haml
+++ b/app/views/admin/users/_users.html.haml
@@ -7,39 +7,39 @@
= nav_link(html_options: { class: active_when(params[:filter].nil?) }) do
= link_to admin_users_path do
= s_('AdminUsers|Active')
- %small.badge.badge-pill= limited_counter_with_delimiter(User.active_without_ghosts)
+ %small.badge.gl-tab-counter-badge.badge-muted.badge-pill.gl-badge.sm= limited_counter_with_delimiter(User.active_without_ghosts)
= nav_link(html_options: { class: active_when(params[:filter] == 'admins') }) do
= link_to admin_users_path(filter: "admins") do
= s_('AdminUsers|Admins')
- %small.badge.badge-pill= limited_counter_with_delimiter(User.admins)
+ %small.badge.gl-tab-counter-badge.badge-muted.badge-pill.gl-badge.sm= limited_counter_with_delimiter(User.admins)
= nav_link(html_options: { class: "#{active_when(params[:filter] == 'two_factor_enabled')} filter-two-factor-enabled" }) do
= link_to admin_users_path(filter: 'two_factor_enabled') do
= s_('AdminUsers|2FA Enabled')
- %small.badge.badge-pill= limited_counter_with_delimiter(User.with_two_factor)
+ %small.badge.gl-tab-counter-badge.badge-muted.badge-pill.gl-badge.sm= limited_counter_with_delimiter(User.with_two_factor)
= nav_link(html_options: { class: "#{active_when(params[:filter] == 'two_factor_disabled')} filter-two-factor-disabled" }) do
= link_to admin_users_path(filter: 'two_factor_disabled') do
= s_('AdminUsers|2FA Disabled')
- %small.badge.badge-pill= limited_counter_with_delimiter(User.without_two_factor)
+ %small.badge.gl-tab-counter-badge.badge-muted.badge-pill.gl-badge.sm= limited_counter_with_delimiter(User.without_two_factor)
= nav_link(html_options: { class: active_when(params[:filter] == 'external') }) do
= link_to admin_users_path(filter: 'external') do
= s_('AdminUsers|External')
- %small.badge.badge-pill= limited_counter_with_delimiter(User.external)
+ %small.badge.gl-tab-counter-badge.badge-muted.badge-pill.gl-badge.sm= limited_counter_with_delimiter(User.external)
= nav_link(html_options: { class: active_when(params[:filter] == 'blocked') }) do
= link_to admin_users_path(filter: "blocked") do
= s_('AdminUsers|Blocked')
- %small.badge.badge-pill= limited_counter_with_delimiter(User.blocked)
+ %small.badge.gl-tab-counter-badge.badge-muted.badge-pill.gl-badge.sm= limited_counter_with_delimiter(User.blocked)
= nav_link(html_options: { class: "#{active_when(params[:filter] == 'blocked_pending_approval')} filter-blocked-pending-approval" }) do
= link_to admin_users_path(filter: "blocked_pending_approval"), data: { qa_selector: 'pending_approval_tab' } do
= s_('AdminUsers|Pending approval')
- %small.badge.badge-pill= limited_counter_with_delimiter(User.blocked_pending_approval)
+ %small.badge.gl-tab-counter-badge.badge-muted.badge-pill.gl-badge.sm= limited_counter_with_delimiter(User.blocked_pending_approval)
= nav_link(html_options: { class: active_when(params[:filter] == 'deactivated') }) do
= link_to admin_users_path(filter: "deactivated") do
= s_('AdminUsers|Deactivated')
- %small.badge.badge-pill= limited_counter_with_delimiter(User.deactivated)
+ %small.badge.gl-tab-counter-badge.badge-muted.badge-pill.gl-badge.sm= limited_counter_with_delimiter(User.deactivated)
= nav_link(html_options: { class: active_when(params[:filter] == 'wop') }) do
= link_to admin_users_path(filter: "wop") do
= s_('AdminUsers|Without projects')
- %small.badge.badge-pill= limited_counter_with_delimiter(User.without_projects)
+ %small.badge.gl-tab-counter-badge.badge-muted.badge-pill.gl-badge.sm= limited_counter_with_delimiter(User.without_projects)
.nav-controls
= render_if_exists 'admin/users/admin_email_users'
= render_if_exists 'admin/users/admin_export_user_permissions'
diff --git a/app/views/dashboard/todos/index.html.haml b/app/views/dashboard/todos/index.html.haml
index a0016417f0c..66587518efc 100644
--- a/app/views/dashboard/todos/index.html.haml
+++ b/app/views/dashboard/todos/index.html.haml
@@ -15,13 +15,13 @@
= link_to todos_filter_path(state: 'pending') do
%span
To Do
- %span.badge.badge-pill
+ %span.badge.gl-tab-counter-badge.badge-muted.badge-pill.gl-badge.sm
= number_with_delimiter(todos_pending_count)
%li.todos-done{ class: active_when(params[:state] == 'done') }>
= link_to todos_filter_path(state: 'done') do
%span
Done
- %span.badge.badge-pill
+ %span.badge.gl-tab-counter-badge.badge-muted.badge-pill.gl-badge.sm
= number_with_delimiter(todos_done_count)
.nav-controls
diff --git a/app/views/groups/milestones/_header_title.html.haml b/app/views/groups/milestones/_header_title.html.haml
index 24eb39b8e2f..f222dba1f90 100644
--- a/app/views/groups/milestones/_header_title.html.haml
+++ b/app/views/groups/milestones/_header_title.html.haml
@@ -1,2 +1,2 @@
- breadcrumb_title @milestone.title
-- add_to_breadcrumbs "Milestones", group_milestones_path(@group)
+- add_to_breadcrumbs _("Milestones"), group_milestones_path(@group)
diff --git a/app/views/profiles/preferences/show.html.haml b/app/views/profiles/preferences/show.html.haml
index 535964028f4..0adad6b64a0 100644
--- a/app/views/profiles/preferences/show.html.haml
+++ b/app/views/profiles/preferences/show.html.haml
@@ -100,7 +100,7 @@
.form-group
= f.label :tab_width, s_('Preferences|Tab width'), class: 'label-bold'
= f.number_field :tab_width,
- class: 'form-control',
+ class: 'form-control gl-form-input',
min: Gitlab::TabWidth::MIN,
max: Gitlab::TabWidth::MAX,
required: true