diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-12 18:12:37 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-12 18:12:37 +0300 |
commit | 76cbe9e688549d47b0055573380b908cf9a72ed1 (patch) | |
tree | c4babdf84dc405f46f4c134fb486d28d7109719c /app | |
parent | ce07dcdcf59419b41b286fce079750aa1d0a478b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/projects/tags_controller.rb | 22 | ||||
-rw-r--r-- | app/controllers/projects/tree_controller.rb | 1 | ||||
-rw-r--r-- | app/controllers/projects_controller.rb | 6 | ||||
-rw-r--r-- | app/finders/snippets_finder.rb | 27 | ||||
-rw-r--r-- | app/finders/tags_finder.rb | 4 | ||||
-rw-r--r-- | app/models/namespace.rb | 3 | ||||
-rw-r--r-- | app/views/admin/users/_users.html.haml | 72 | ||||
-rw-r--r-- | app/views/projects/blame/show.html.haml | 2 |
8 files changed, 75 insertions, 62 deletions
diff --git a/app/controllers/projects/tags_controller.rb b/app/controllers/projects/tags_controller.rb index 581680f1b13..00b0b791f01 100644 --- a/app/controllers/projects/tags_controller.rb +++ b/app/controllers/projects/tags_controller.rb @@ -14,18 +14,24 @@ class Projects::TagsController < Projects::ApplicationController # rubocop: disable CodeReuse/ActiveRecord def index - params[:sort] = params[:sort].presence || sort_value_recently_updated + begin + params[:sort] = params[:sort].presence || sort_value_recently_updated - @sort = params[:sort] + @sort = params[:sort] - @tags, @tags_loading_error = TagsFinder.new(@repository, params).execute + @tags = TagsFinder.new(@repository, params).execute - @tags = Kaminari.paginate_array(@tags).page(params[:page]) - tag_names = @tags.map(&:name) - @tags_pipelines = @project.ci_pipelines.latest_successful_for_refs(tag_names) + @tags = Kaminari.paginate_array(@tags).page(params[:page]) + tag_names = @tags.map(&:name) + @tags_pipelines = @project.ci_pipelines.latest_successful_for_refs(tag_names) - @releases = project.releases.where(tag: tag_names) - @tag_pipeline_statuses = Ci::CommitStatusesFinder.new(@project, @repository, current_user, @tags).execute + @releases = project.releases.where(tag: tag_names) + @tag_pipeline_statuses = Ci::CommitStatusesFinder.new(@project, @repository, current_user, @tags).execute + + rescue Gitlab::Git::CommandError => e + @tags = [] + @tags_loading_error = e + end respond_to do |format| status = @tags_loading_error ? :service_unavailable : :ok diff --git a/app/controllers/projects/tree_controller.rb b/app/controllers/projects/tree_controller.rb index a76d45411dd..72bb03b63a3 100644 --- a/app/controllers/projects/tree_controller.rb +++ b/app/controllers/projects/tree_controller.rb @@ -19,6 +19,7 @@ class Projects::TreeController < Projects::ApplicationController push_frontend_feature_flag(:lazy_load_commits, @project, default_enabled: :yaml) push_frontend_feature_flag(:paginated_tree_graphql_query, @project, default_enabled: :yaml) push_frontend_feature_flag(:new_dir_modal, @project, default_enabled: :yaml) + push_frontend_feature_flag(:refactor_blob_viewer, @project, default_enabled: :yaml) end feature_category :source_code_management diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 9dcd3984011..bbf33865a26 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -293,7 +293,11 @@ class ProjectsController < Projects::ApplicationController end if find_tags && @repository.tag_count.nonzero? - tags, _ = TagsFinder.new(@repository, params).execute + tags = begin + TagsFinder.new(@repository, params).execute + rescue Gitlab::Git::CommandError + [] + end options['Tags'] = tags.take(100).map(&:name) end diff --git a/app/finders/snippets_finder.rb b/app/finders/snippets_finder.rb index 81643826782..b1e12721712 100644 --- a/app/finders/snippets_finder.rb +++ b/app/finders/snippets_finder.rb @@ -42,12 +42,11 @@ class SnippetsFinder < UnionFinder include FinderMethods include Gitlab::Utils::StrongMemoize - attr_accessor :current_user, :params - delegate :explore, :only_personal, :only_project, :scope, :sort, to: :params + attr_reader :current_user, :params def initialize(current_user = nil, params = {}) @current_user = current_user - @params = OpenStruct.new(params) + @params = params if project && author raise( @@ -77,9 +76,9 @@ class SnippetsFinder < UnionFinder private def init_collection - if explore + if explore? snippets_for_explore - elsif only_personal + elsif only_personal? personal_snippets elsif project snippets_for_a_single_project @@ -110,7 +109,7 @@ class SnippetsFinder < UnionFinder # over the resulting SQL query. def snippets_for_personal_and_multiple_projects queries = [] - queries << personal_snippets unless only_project + queries << personal_snippets unless only_project? if Ability.allowed?(current_user, :read_cross_project) queries << snippets_of_visible_projects @@ -171,7 +170,7 @@ class SnippetsFinder < UnionFinder end def visibility_from_scope - case scope.to_s + case params[:scope].to_s when 'are_private' Snippet::PRIVATE when 'are_internal' @@ -206,7 +205,19 @@ class SnippetsFinder < UnionFinder end def sort_param - sort.presence || 'id_desc' + params[:sort].presence || 'id_desc' + end + + def explore? + params[:explore].present? + end + + def only_personal? + params[:only_personal].present? + end + + def only_project? + params[:only_project].present? end def prepared_union(queries) diff --git a/app/finders/tags_finder.rb b/app/finders/tags_finder.rb index 0ccbbdc1b87..36ca2c7f281 100644 --- a/app/finders/tags_finder.rb +++ b/app/finders/tags_finder.rb @@ -8,8 +8,6 @@ class TagsFinder < GitRefsFinder def execute tags = repository.tags_sorted_by(sort) - [by_search(tags), nil] - rescue Gitlab::Git::CommandError => e - [[], e] + by_search(tags) end end diff --git a/app/models/namespace.rb b/app/models/namespace.rb index 14a0c38dcf0..9565d1a6a69 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -17,6 +17,9 @@ class Namespace < ApplicationRecord include EachBatch ignore_column :delayed_project_removal, remove_with: '14.1', remove_after: '2021-05-22' + # Temporary column used for back-filling project namespaces. + # Remove it once the back-filling of all project namespaces is done. + ignore_column :tmp_project_id, remove_with: '14.7', remove_after: '2022-01-22' # Tells ActiveRecord not to store the full class name, in order to save some space # https://gitlab.com/gitlab-org/gitlab/-/merge_requests/69794 diff --git a/app/views/admin/users/_users.html.haml b/app/views/admin/users/_users.html.haml index 1a43d91b800..e62e4cfa192 100644 --- a/app/views/admin/users/_users.html.haml +++ b/app/views/admin/users/_users.html.haml @@ -3,48 +3,38 @@ = sprite_icon('chevron-lg-left', size: 12) .fade-right = sprite_icon('chevron-lg-right', size: 12) - %ul.nav-links.nav.nav-tabs.scrolling-tabs - = nav_link(html_options: { class: active_when(params[:filter].nil?) }) do - = link_to admin_users_path do - = s_('AdminUsers|Active') - %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.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.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.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.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.gl-tab-counter-badge.badge-muted.badge-pill.gl-badge.sm= limited_counter_with_delimiter(User.blocked) + = gl_tabs_nav({ class: 'scrolling-tabs nav-links gl-display-flex gl-flex-grow-1' }) do + = gl_tab_link_to admin_users_path, { item_active: active_when(params[:filter].nil?), class: 'gl-border-0!' } do + = s_('AdminUsers|Active') + = gl_tab_counter_badge(limited_counter_with_delimiter(User.active_without_ghosts)) + = gl_tab_link_to admin_users_path(filter: "admins"), { item_active: active_when(params[:filter] == 'admins'), class: 'gl-border-0!' } do + = s_('AdminUsers|Admins') + = gl_tab_counter_badge(limited_counter_with_delimiter(User.admins)) + = gl_tab_link_to admin_users_path(filter: 'two_factor_enabled'), { item_active: active_when(params[:filter] == 'two_factor_enabled'), class: 'filter-two-factor-enabled gl-border-0!' } do + = s_('AdminUsers|2FA Enabled') + = gl_tab_counter_badge(limited_counter_with_delimiter(User.with_two_factor)) + = gl_tab_link_to admin_users_path(filter: 'two_factor_disabled'), { item_active: active_when(params[:filter] == 'two_factor_disabled'), class: 'filter-two-factor-disabled gl-border-0!' } do + = s_('AdminUsers|2FA Disabled') + = gl_tab_counter_badge(limited_counter_with_delimiter(User.without_two_factor)) + = gl_tab_link_to admin_users_path(filter: 'external'), { item_active: active_when(params[:filter] == 'external'), class: 'gl-border-0!' } do + = s_('AdminUsers|External') + = gl_tab_counter_badge(limited_counter_with_delimiter(User.external)) + = gl_tab_link_to admin_users_path(filter: "blocked"), { item_active: active_when(params[:filter] == 'blocked'), class: 'gl-border-0!' } do + = s_('AdminUsers|Blocked') + = gl_tab_counter_badge(limited_counter_with_delimiter(User.blocked)) - if ban_feature_available? - = nav_link(html_options: { class: active_when(params[:filter] == 'banned') }) do - = link_to admin_users_path(filter: "banned") do - = s_('AdminUsers|Banned') - %small.badge.gl-tab-counter-badge.badge-muted.badge-pill.gl-badge.sm= limited_counter_with_delimiter(User.banned) - = 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.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.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.gl-tab-counter-badge.badge-muted.badge-pill.gl-badge.sm= limited_counter_with_delimiter(User.without_projects) + = gl_tab_link_to admin_users_path(filter: "banned"), { item_active: active_when(params[:filter] == 'banned'), class: 'gl-border-0!' } do + = s_('AdminUsers|Banned') + = gl_tab_counter_badge(limited_counter_with_delimiter(User.banned)) + = gl_tab_link_to admin_users_path(filter: "blocked_pending_approval"), { item_active: active_when(params[:filter] == 'blocked_pending_approval'), class: 'filter-blocked-pending-approval gl-border-0!', data: { qa_selector: 'pending_approval_tab' } } do + = s_('AdminUsers|Pending approval') + = gl_tab_counter_badge(limited_counter_with_delimiter(User.blocked_pending_approval)) + = gl_tab_link_to admin_users_path(filter: "deactivated"), { item_active: active_when(params[:filter] == 'deactivated'), class: 'gl-border-0!' } do + = s_('AdminUsers|Deactivated') + = gl_tab_counter_badge(limited_counter_with_delimiter(User.deactivated)) + = gl_tab_link_to admin_users_path(filter: "wop"), { item_active: active_when(params[:filter] == 'wop'), class: 'gl-border-0!' } do + = s_('AdminUsers|Without projects') + = gl_tab_counter_badge(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/projects/blame/show.html.haml b/app/views/projects/blame/show.html.haml index 30c052e054f..704576619a7 100644 --- a/app/views/projects/blame/show.html.haml +++ b/app/views/projects/blame/show.html.haml @@ -20,7 +20,7 @@ %span.legend-box.legend-box-9 %span.right-label Older - .table-responsive.file-content.blame.code.js-syntax-highlight + .table-responsive.file-content.blame.code{ class: user_color_scheme } %table - current_line = 1 - @blame.groups.each do |blame_group| |