diff options
Diffstat (limited to 'app')
17 files changed, 67 insertions, 88 deletions
diff --git a/app/assets/javascripts/repository/components/table/row.vue b/app/assets/javascripts/repository/components/table/row.vue index 88a7e3e3a68..9cf42b34974 100644 --- a/app/assets/javascripts/repository/components/table/row.vue +++ b/app/assets/javascripts/repository/components/table/row.vue @@ -1,7 +1,7 @@ <script> import { escapeRegExp } from 'lodash'; import { GlBadge, GlLink, GlSkeletonLoading, GlTooltipDirective, GlLoadingIcon } from '@gitlab/ui'; -import { visitUrl, escapeFileUrl } from '~/lib/utils/url_utility'; +import { escapeFileUrl } from '~/lib/utils/url_utility'; import TimeagoTooltip from '~/vue_shared/components/time_ago_tooltip.vue'; import Icon from '~/vue_shared/components/icon.vue'; import { getIconName } from '../../utils/icon'; @@ -117,39 +117,37 @@ export default { return this.commit && this.commit.lockLabel; }, }, - methods: { - openRow(e) { - if (e.target.tagName === 'A') return; - - if (this.isFolder && !e.metaKey) { - this.$router.push(this.routerLinkTo); - } else { - visitUrl(this.url, e.metaKey); - } - }, - }, }; </script> <template> - <tr :class="`file_${id}`" class="tree-item" @click="openRow"> - <td class="tree-item-file-name"> + <tr class="tree-item"> + <td class="tree-item-file-name cursor-default position-relative"> <gl-loading-icon v-if="path === loadingPath" size="sm" inline class="d-inline-block align-text-bottom fa-fw" /> - <i v-else :aria-label="type" role="img" :class="iconName" class="fa fa-fw"></i> <component :is="linkComponent" ref="link" :to="routerLinkTo" :href="url" - class="str-truncated" + :class="{ + 'is-submodule': isSubmodule, + }" + class="tree-item-link str-truncated" data-qa-selector="file_name_link" > - {{ fullPath }} + <i + v-if="!loadingPath" + :aria-label="type" + role="img" + :class="iconName" + class="fa fa-fw mr-1" + ></i + ><span class="position-relative">{{ fullPath }}</span> </component> <!-- eslint-disable-next-line @gitlab/vue-require-i18n-strings --> <gl-badge v-if="lfsOid" variant="default" class="label-lfs ml-1">LFS</gl-badge> @@ -165,7 +163,7 @@ export default { class="ml-2 vertical-align-middle" /> </td> - <td class="d-none d-sm-table-cell tree-commit"> + <td class="d-none d-sm-table-cell tree-commit cursor-default"> <gl-link v-if="commit" :href="commit.commitPath" @@ -176,7 +174,7 @@ export default { </gl-link> <gl-skeleton-loading v-else :lines="1" class="h-auto" /> </td> - <td class="tree-time-ago text-right"> + <td class="tree-time-ago text-right cursor-default"> <timeago-tooltip v-if="commit" :time="commit.committedDate" /> <gl-skeleton-loading v-else :lines="1" class="ml-auto h-auto w-50" /> </td> diff --git a/app/assets/stylesheets/framework/files.scss b/app/assets/stylesheets/framework/files.scss index bb1c304b9fe..9d21b67c95e 100644 --- a/app/assets/stylesheets/framework/files.scss +++ b/app/assets/stylesheets/framework/files.scss @@ -511,3 +511,21 @@ span.idiff { .code-navigation-popover { max-width: 450px; } + +.tree-item-link { + &:not(.is-submodule) { + span { + z-index: 2; + } + + &::before { + content: ''; + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 100%; + z-index: 1; + } + } +} diff --git a/app/controllers/projects/merge_requests/diffs_controller.rb b/app/controllers/projects/merge_requests/diffs_controller.rb index 953b2ffeb0b..1fb5e333aaa 100644 --- a/app/controllers/projects/merge_requests/diffs_controller.rb +++ b/app/controllers/projects/merge_requests/diffs_controller.rb @@ -65,7 +65,7 @@ class Projects::MergeRequests::DiffsController < Projects::MergeRequests::Applic options = additional_attributes.merge(diff_view: diff_view) if @merge_request.project.context_commits_enabled? - options[:context_commits] = @merge_request.context_commits + options[:context_commits] = @merge_request.recent_context_commits end render json: DiffsSerializer.new(request).represent(diffs, options) diff --git a/app/graphql/resolvers/error_tracking/sentry_detailed_error_resolver.rb b/app/graphql/resolvers/error_tracking/sentry_detailed_error_resolver.rb index 72c5c19c25c..5027403e95c 100644 --- a/app/graphql/resolvers/error_tracking/sentry_detailed_error_resolver.rb +++ b/app/graphql/resolvers/error_tracking/sentry_detailed_error_resolver.rb @@ -9,7 +9,7 @@ module Resolvers def resolve(**args) current_user = context[:current_user] - issue_id = GlobalID.parse(args[:id]).model_id + issue_id = GlobalID.parse(args[:id])&.model_id # Get data from Sentry response = ::ErrorTracking::IssueDetailsService.new( diff --git a/app/graphql/resolvers/error_tracking/sentry_error_stack_trace_resolver.rb b/app/graphql/resolvers/error_tracking/sentry_error_stack_trace_resolver.rb index f5356660569..c365baaf475 100644 --- a/app/graphql/resolvers/error_tracking/sentry_error_stack_trace_resolver.rb +++ b/app/graphql/resolvers/error_tracking/sentry_error_stack_trace_resolver.rb @@ -8,7 +8,7 @@ module Resolvers description: 'ID of the Sentry issue' def resolve(**args) - issue_id = GlobalID.parse(args[:id]).model_id + issue_id = GlobalID.parse(args[:id])&.model_id # Get data from Sentry response = ::ErrorTracking::IssueLatestEventService.new( diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 412d0fa4ec8..bb7afc49cd8 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -410,8 +410,16 @@ class MergeRequest < ApplicationRecord "#{project.to_reference_base(from, full: full)}#{reference}" end - def context_commits - @context_commits ||= merge_request_context_commits.map(&:to_commit) + def context_commits(limit: nil) + @context_commits ||= merge_request_context_commits.limit(limit).map(&:to_commit) + end + + def recent_context_commits + context_commits(limit: MergeRequestDiff::COMMITS_SAFE_SIZE) + end + + def context_commits_count + context_commits.count end def commits(limit: nil) diff --git a/app/models/resource_milestone_event.rb b/app/models/resource_milestone_event.rb index d362ebc307a..b97c02f1713 100644 --- a/app/models/resource_milestone_event.rb +++ b/app/models/resource_milestone_event.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true class ResourceMilestoneEvent < ResourceEvent + include IgnorableColumns + belongs_to :issue belongs_to :merge_request belongs_to :milestone @@ -18,6 +20,8 @@ class ResourceMilestoneEvent < ResourceEvent # state is used for issue and merge request states. enum state: Issue.available_states.merge(MergeRequest.available_states) + ignore_columns %i[reference reference_html cached_markdown_version], remove_with: '13.1', remove_after: '2020-06-22' + def self.issuable_attrs %i(issue merge_request).freeze end diff --git a/app/serializers/commit_entity.rb b/app/serializers/commit_entity.rb index ae3f1c6bbf5..c9c4981682a 100644 --- a/app/serializers/commit_entity.rb +++ b/app/serializers/commit_entity.rb @@ -1,49 +1,4 @@ # frozen_string_literal: true -class CommitEntity < API::Entities::Commit - include MarkupHelper - include RequestAwareEntity - - expose :author, using: UserEntity - - expose :author_gravatar_url do |commit| - GravatarService.new.execute(commit.author_email) # rubocop: disable CodeReuse/ServiceClass - end - - expose :commit_url do |commit, options| - project_commit_url(request.project, commit, params: options.fetch(:commit_url_params, {})) - end - - expose :commit_path do |commit, options| - project_commit_path(request.project, commit, params: options.fetch(:commit_url_params, {})) - end - - expose :description_html, if: { type: :full } do |commit| - markdown_field(commit, :description) - end - - expose :title_html, if: { type: :full } do |commit| - markdown_field(commit, :title) - end - - expose :signature_html, if: { type: :full } do |commit| - render('projects/commit/_signature', signature: commit.signature) if commit.has_signature? - end - - expose :pipeline_status_path, if: { type: :full } do |commit, options| - pipeline_ref = options[:pipeline_ref] - pipeline_project = options[:pipeline_project] || commit.project - next unless pipeline_ref && pipeline_project - - pipeline = commit.latest_pipeline_for_project(pipeline_ref, pipeline_project) - next unless pipeline&.status - - pipelines_project_commit_path(pipeline_project, commit.id, ref: pipeline_ref) - end - - def render(*args) - return unless request.respond_to?(:render) && request.render.respond_to?(:call) - - request.render.call(*args) - end +class CommitEntity < API::Entities::CommitWithLink end diff --git a/app/serializers/user_entity.rb b/app/serializers/user_entity.rb index 656900bb8af..8909ae8df2c 100644 --- a/app/serializers/user_entity.rb +++ b/app/serializers/user_entity.rb @@ -1,10 +1,4 @@ # frozen_string_literal: true -class UserEntity < API::Entities::UserBasic - include RequestAwareEntity - include UserStatusTooltip - - expose :path do |user| - user_path(user) - end +class UserEntity < API::Entities::UserPath end diff --git a/app/services/issuable/clone/attributes_rewriter.rb b/app/services/issuable/clone/attributes_rewriter.rb index 135ab011d69..55f5629baac 100644 --- a/app/services/issuable/clone/attributes_rewriter.rb +++ b/app/services/issuable/clone/attributes_rewriter.rb @@ -74,7 +74,7 @@ module Issuable if matching_destination_milestone.present? event.attributes - .except('id', 'reference', 'reference_html') + .except('id') .merge(entity_key => new_entity.id, 'milestone_id' => matching_destination_milestone.id, 'action' => ResourceMilestoneEvent.actions[event.action], diff --git a/app/services/metrics/dashboard/clone_dashboard_service.rb b/app/services/metrics/dashboard/clone_dashboard_service.rb index c31d6d326e3..ee5b50aefc3 100644 --- a/app/services/metrics/dashboard/clone_dashboard_service.rb +++ b/app/services/metrics/dashboard/clone_dashboard_service.rb @@ -6,7 +6,7 @@ module Metrics module Dashboard class CloneDashboardService < ::BaseService ALLOWED_FILE_TYPE = '.yml' - USER_DASHBOARDS_DIR = ::Metrics::Dashboard::ProjectDashboardService::DASHBOARD_ROOT + USER_DASHBOARDS_DIR = ::Metrics::Dashboard::CustomDashboardService::DASHBOARD_ROOT class << self def allowed_dashboard_templates @@ -52,7 +52,7 @@ module Metrics def dashboard_details { path: new_dashboard_path, - display_name: ::Metrics::Dashboard::ProjectDashboardService.name_for_path(new_dashboard_path), + display_name: ::Metrics::Dashboard::CustomDashboardService.name_for_path(new_dashboard_path), default: false, system_dashboard: false } diff --git a/app/services/metrics/dashboard/project_dashboard_service.rb b/app/services/metrics/dashboard/custom_dashboard_service.rb index fadbe0fae01..77173813a4f 100644 --- a/app/services/metrics/dashboard/project_dashboard_service.rb +++ b/app/services/metrics/dashboard/custom_dashboard_service.rb @@ -5,7 +5,7 @@ # Use Gitlab::Metrics::Dashboard::Finder to retrive dashboards. module Metrics module Dashboard - class ProjectDashboardService < ::Metrics::Dashboard::BaseService + class CustomDashboardService < ::Metrics::Dashboard::BaseService DASHBOARD_ROOT = ".gitlab/dashboards" class << self diff --git a/app/services/metrics/dashboard/update_dashboard_service.rb b/app/services/metrics/dashboard/update_dashboard_service.rb index 25a727ad44c..d37d06a0222 100644 --- a/app/services/metrics/dashboard/update_dashboard_service.rb +++ b/app/services/metrics/dashboard/update_dashboard_service.rb @@ -7,7 +7,7 @@ module Metrics include Stepable ALLOWED_FILE_TYPE = '.yml' - USER_DASHBOARDS_DIR = ::Metrics::Dashboard::ProjectDashboardService::DASHBOARD_ROOT + USER_DASHBOARDS_DIR = ::Metrics::Dashboard::CustomDashboardService::DASHBOARD_ROOT steps :check_push_authorized, :check_branch_name, @@ -117,7 +117,7 @@ module Metrics def dashboard_details { path: update_dashboard_path, - display_name: ::Metrics::Dashboard::ProjectDashboardService.name_for_path(update_dashboard_path), + display_name: ::Metrics::Dashboard::CustomDashboardService.name_for_path(update_dashboard_path), default: false, system_dashboard: false } diff --git a/app/views/projects/wikis/_sidebar.html.haml b/app/views/projects/wikis/_sidebar.html.haml index 83d145444d8..0f2938686cc 100644 --- a/app/views/projects/wikis/_sidebar.html.haml +++ b/app/views/projects/wikis/_sidebar.html.haml @@ -17,5 +17,6 @@ %ul.wiki-pages = render @sidebar_wiki_entries, context: 'sidebar' .block.w-100 - = link_to project_wikis_pages_path(@project), class: 'btn btn-block' do - = s_("Wiki|More Pages") + - if @sidebar_wiki_entries&.length.to_i >= 15 + = link_to project_wikis_pages_path(@project), class: 'btn btn-block' do + = s_("Wiki|View All Pages") diff --git a/app/views/shared/web_hooks/_index.html.haml b/app/views/shared/web_hooks/_index.html.haml index b22d51a101a..149f4baeb21 100644 --- a/app/views/shared/web_hooks/_index.html.haml +++ b/app/views/shared/web_hooks/_index.html.haml @@ -3,7 +3,7 @@ .card-header %h5 = hook_class.underscore.humanize.titleize.pluralize - (#{hooks.count}) + (#{hooks.load.size}) - if hooks.any? %ul.content-list diff --git a/app/workers/all_queues.yml b/app/workers/all_queues.yml index 19158e7173c..f4d8483db84 100644 --- a/app/workers/all_queues.yml +++ b/app/workers/all_queues.yml @@ -891,7 +891,7 @@ :urgency: :low :resource_boundary: :unknown :weight: 1 - :idempotent: + :idempotent: true - :name: update_namespace_statistics:namespaces_schedule_aggregation :feature_category: :source_code_management :has_external_dependencies: diff --git a/app/workers/namespaces/root_statistics_worker.rb b/app/workers/namespaces/root_statistics_worker.rb index 70b2510488b..5d4b510ceb7 100644 --- a/app/workers/namespaces/root_statistics_worker.rb +++ b/app/workers/namespaces/root_statistics_worker.rb @@ -1,11 +1,12 @@ # frozen_string_literal: true module Namespaces - class RootStatisticsWorker # rubocop:disable Scalability/IdempotentWorker + class RootStatisticsWorker include ApplicationWorker queue_namespace :update_namespace_statistics feature_category :source_code_management + idempotent! def perform(namespace_id) namespace = Namespace.find(namespace_id) |