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>2023-11-01 09:12:32 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-11-01 09:12:32 +0300
commit50c3e720725fa9739587ff76c645331ecf9d95d6 (patch)
treed8b72ff3cc2d0cacfc6f918ad0b3a07cbd46085a /app
parent24ed1c84da7fb6df910f06552bc9e2e7fe5bcb59 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/pages/users/user_tabs.js2
-rw-r--r--app/assets/stylesheets/pages/notes.scss42
-rw-r--r--app/controllers/repositories/git_http_controller.rb3
-rw-r--r--app/helpers/events_helper.rb42
-rw-r--r--app/models/user.rb2
-rw-r--r--app/views/events/_event.html.haml2
-rw-r--r--app/views/events/event/_common.html.haml4
-rw-r--r--app/views/events/event/_design.html.haml2
-rw-r--r--app/views/events/event/_note.html.haml2
-rw-r--r--app/views/events/event/_wiki.html.haml2
-rw-r--r--app/views/users/_overview.html.haml4
-rw-r--r--app/views/users/show.html.haml16
-rw-r--r--app/workers/concerns/gitlab/github_import/stage_methods.rb25
-rw-r--r--app/workers/gitlab/github_import/stage/import_attachments_worker.rb2
-rw-r--r--app/workers/gitlab/github_import/stage/import_issue_events_worker.rb2
-rw-r--r--app/workers/gitlab/github_import/stage/import_issues_and_diff_notes_worker.rb2
-rw-r--r--app/workers/gitlab/github_import/stage/import_lfs_objects_worker.rb5
-rw-r--r--app/workers/gitlab/github_import/stage/import_notes_worker.rb2
-rw-r--r--app/workers/gitlab/github_import/stage/import_pull_requests_merged_by_worker.rb2
-rw-r--r--app/workers/gitlab/github_import/stage/import_pull_requests_review_requests_worker.rb2
-rw-r--r--app/workers/gitlab/github_import/stage/import_pull_requests_reviews_worker.rb2
-rw-r--r--app/workers/gitlab/github_import/stage/import_pull_requests_worker.rb2
22 files changed, 117 insertions, 52 deletions
diff --git a/app/assets/javascripts/pages/users/user_tabs.js b/app/assets/javascripts/pages/users/user_tabs.js
index 430022f9a9b..d368c76b6cc 100644
--- a/app/assets/javascripts/pages/users/user_tabs.js
+++ b/app/assets/javascripts/pages/users/user_tabs.js
@@ -194,7 +194,7 @@ export default class UserTabs {
this.loadActivityCalendar();
UserTabs.renderMostRecentBlocks('#js-overview .activities-block', {
- requestParams: { limit: 10 },
+ requestParams: { limit: 15 },
});
UserTabs.renderMostRecentBlocks('#js-overview .projects-block', {
requestParams: { limit: 10, skip_pagination: true, skip_namespace: true, compact_mode: true },
diff --git a/app/assets/stylesheets/pages/notes.scss b/app/assets/stylesheets/pages/notes.scss
index 2722893d04c..8e0fab04ab2 100644
--- a/app/assets/stylesheets/pages/notes.scss
+++ b/app/assets/stylesheets/pages/notes.scss
@@ -10,16 +10,13 @@ $icon-size-diff: $avatar-icon-size - $system-note-icon-size;
$system-note-icon-m-top: $avatar-m-top + $icon-size-diff - 1.3rem;
$system-note-icon-m-left: $avatar-m-left + $icon-size-diff / $avatar-m-ratio;
-@mixin vertical-line($left) {
- &::before {
- content: '';
- border-left: 2px solid var(--gray-50, $gray-50);
- position: absolute;
- top: 16px;
- bottom: 0;
- left: calc(#{$left} - 1px);
- height: calc(100% + 20px);
- }
+@mixin vertical-line($top, $left) {
+ content: '';
+ position: absolute;
+ width: 2px;
+ left: $left;
+ top: $top;
+ height: calc(100% - #{$top});
}
@mixin outline-comment() {
@@ -32,12 +29,7 @@ $system-note-icon-m-left: $avatar-m-left + $icon-size-diff / $avatar-m-ratio;
.limited-width-notes {
.main-notes-list::before,
.timeline-entry:last-child::before {
- content: '';
- position: absolute;
- width: 2px;
- left: 15px;
- top: 15px;
- height: calc(100% - 15px);
+ @include vertical-line(15px, 15px);
}
.main-notes-list::before {
@@ -1143,6 +1135,24 @@ $system-note-icon-m-left: $avatar-m-left + $icon-size-diff / $avatar-m-ratio;
}
}
+.user-activity-content {
+ &::before {
+ @include vertical-line(80px, 25px);
+ background: var(--gray-50, $gray-50);
+ }
+
+ .system-note-image {
+ @include gl--flex-center;
+ top: 14px;
+ width: 22px;
+ height: 22px;
+
+ svg {
+ fill: $gray-600 !important;
+ }
+ }
+}
+
//This needs to be deleted when Snippet/Commit comments are convered to Vue
// See https://gitlab.com/gitlab-org/gitlab-foss/issues/53918#note_117038785
.unstyled-comments {
diff --git a/app/controllers/repositories/git_http_controller.rb b/app/controllers/repositories/git_http_controller.rb
index 4f228ced542..f78a28c89dd 100644
--- a/app/controllers/repositories/git_http_controller.rb
+++ b/app/controllers/repositories/git_http_controller.rb
@@ -106,7 +106,8 @@ module Repositories
def access_actor
return user if user
- return :ci if ci?
+
+ :ci if ci?
end
def access_check
diff --git a/app/helpers/events_helper.rb b/app/helpers/events_helper.rb
index 5f1145c95f6..769af0d9ef9 100644
--- a/app/helpers/events_helper.rb
+++ b/app/helpers/events_helper.rb
@@ -13,7 +13,10 @@ module EventsHelper
'deleted' => 'remove',
'destroyed' => 'remove',
'imported' => 'import',
- 'joined' => 'users'
+ 'joined' => 'users',
+ 'approved' => 'check',
+ 'added' => 'upload',
+ 'removed' => 'remove'
}.freeze
def localized_action_name_map
@@ -242,7 +245,7 @@ module EventsHelper
def event_wiki_title_html(event)
capture do
- concat content_tag(:span, _('wiki page'), class: "event-target-type gl-mr-2")
+ concat content_tag(:span, _('wiki page'), class: "event-target-type gl-mr-2 #{user_profile_activity_classes}")
concat link_to(
event.target_title,
event_wiki_page_target_url(event),
@@ -254,7 +257,7 @@ module EventsHelper
def event_design_title_html(event)
capture do
- concat content_tag(:span, _('design'), class: "event-target-type gl-mr-2")
+ concat content_tag(:span, _('design'), class: "event-target-type gl-mr-2 #{user_profile_activity_classes}")
concat link_to(
event.design.reference_link_text,
design_url(event.design),
@@ -271,7 +274,7 @@ module EventsHelper
def event_note_title_html(event)
if event.note_target
capture do
- concat content_tag(:span, event.note_target_type_name, class: "event-target-type gl-mr-2")
+ concat content_tag(:span, event.note_target_type_name, class: "event-target-type gl-mr-2 #{user_profile_activity_classes}")
concat link_to(event.note_target_reference, event_note_target_url(event), title: event.target_title, class: 'has-tooltip event-target-link gl-mr-2')
end
else
@@ -303,19 +306,16 @@ module EventsHelper
end
def icon_for_profile_event(event)
- if current_path?('users#show')
- content_tag :div, class: "system-note-image #{event.action_name.parameterize}-icon" do
- icon_for_event(event.action_name)
- end
- else
- content_tag :div, class: 'system-note-image user-avatar' do
- author_avatar(event, size: 32)
- end
- end
+ base_class = 'system-note-image'
+
+ classes = current_path?('users#activity') ? "#{event.action_name.parameterize}-icon gl-rounded-full gl-bg-gray-50 gl-line-height-0" : "user-avatar"
+ content = current_path?('users#activity') ? icon_for_event(event.action_name, size: 14) : author_avatar(event, size: 32)
+
+ tag.div(class: "#{base_class} #{classes}") { content }
end
def inline_event_icon(event)
- unless current_path?('users#show')
+ unless current_path?('users#activity')
content_tag :span, class: "system-note-image-inline d-none d-sm-flex gl-mr-2 #{event.action_name.parameterize}-icon align-self-center" do
next design_event_icon(event.action, size: 14) if event.design?
@@ -325,13 +325,19 @@ module EventsHelper
end
def event_user_info(event)
- content_tag(:div, class: "event-user-info") do
- concat content_tag(:span, link_to_author(event), class: "author-name")
- concat "&nbsp;".html_safe
- concat content_tag(:span, event.author.to_reference, class: "username")
+ return if current_path?('users#activity')
+
+ tag.div(class: 'event-user-info') do
+ concat tag.span(link_to_author(event), class: 'author-name')
+ concat '&nbsp;'.html_safe
+ concat tag.span(event.author.to_reference, class: 'username')
end
end
+ def user_profile_activity_classes
+ current_path?('users#activity') ? ' gl-font-weight-semibold gl-text-black-normal' : ''
+ end
+
private
def design_url(design, opts = {})
diff --git a/app/models/user.rb b/app/models/user.rb
index bc256ef0f31..7177f1981eb 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -48,7 +48,7 @@ class User < MainClusterwide::ApplicationRecord
# Associations with dependent: option
cross_database_ignore_tables(
- %w[namespaces projects project_authorizations issues merge_requests merge_requests issues issues merge_requests],
+ %w[namespaces projects project_authorizations issues merge_requests merge_requests issues issues merge_requests events],
url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/424285',
on: :destroy
)
diff --git a/app/views/events/_event.html.haml b/app/views/events/_event.html.haml
index a3be188854d..c28fe7c8330 100644
--- a/app/views/events/_event.html.haml
+++ b/app/views/events/_event.html.haml
@@ -1,7 +1,7 @@
- event = event.present
- if event.visible_to_user?(current_user)
- .event-item
+ .event-item{ class: current_path?('users#activity') ? 'user-profile-activity gl-border-bottom-0 gl-pl-7! gl-pb-3' : '' }
.event-item-timestamp.gl-font-sm
#{time_ago_with_tooltip(event.created_at)}
diff --git a/app/views/events/event/_common.html.haml b/app/views/events/event/_common.html.haml
index 7ef3461a7fb..78ce24c429a 100644
--- a/app/views/events/event/_common.html.haml
+++ b/app/views/events/event/_common.html.haml
@@ -5,9 +5,9 @@
.event-title.d-flex.flex-wrap
= inline_event_icon(event)
- if event.target
- %span.event-type.d-inline-block.gl-mr-2{ class: event.action_name }
+ %span.event-type.d-inline-block.gl-mr-2{ class: event.action_name + user_profile_activity_classes }
= localized_action_name(event)
- %span.event-target-type.gl-mr-2= event.target_type_name
+ %span.event-target-type.gl-mr-2{ class: user_profile_activity_classes }= event.target_type_name
= link_to event_target_path(event), class: 'has-tooltip event-target-link gl-mr-2', title: event.target_title do
= event.target.reference_link_text
- unless event.milestone?
diff --git a/app/views/events/event/_design.html.haml b/app/views/events/event/_design.html.haml
index c1fa1aaca50..945c7465ea8 100644
--- a/app/views/events/event/_design.html.haml
+++ b/app/views/events/event/_design.html.haml
@@ -4,7 +4,7 @@
.event-title.d-flex.flex-wrap
= inline_event_icon(event)
- %span.event-type.d-inline-block.gl-mr-2{ class: event.action_name }
+ %span.event-type.d-inline-block.gl-mr-2{ class: event.action_name + user_profile_activity_classes }
= event.action_name
= event_design_title_html(event)
= render "events/event_scope", event: event
diff --git a/app/views/events/event/_note.html.haml b/app/views/events/event/_note.html.haml
index 53c59474d83..5bbece84e40 100644
--- a/app/views/events/event/_note.html.haml
+++ b/app/views/events/event/_note.html.haml
@@ -6,7 +6,7 @@
.event-title.d-flex.flex-wrap
= inline_event_icon(event)
- %span.event-type.d-inline-block.gl-mr-2{ class: event.action_name }
+ %span.event-type.d-inline-block.gl-mr-2{ class: event.action_name + user_profile_activity_classes }
= event.action_name
= event_note_title_html(event)
- title = note_target_title(event.target)
diff --git a/app/views/events/event/_wiki.html.haml b/app/views/events/event/_wiki.html.haml
index cbd5ebcae12..a48c34f80d8 100644
--- a/app/views/events/event/_wiki.html.haml
+++ b/app/views/events/event/_wiki.html.haml
@@ -4,7 +4,7 @@
.event-title.d-flex.flex-wrap
= inline_event_icon(event)
- %span.event-type.d-inline-block.gl-mr-2{ class: event.action_name }
+ %span.event-type.d-inline-block.gl-mr-2{ class: event.action_name + user_profile_activity_classes }
= event.action_name
= event_wiki_title_html(event)
= render "events/event_scope", event: event
diff --git a/app/views/users/_overview.html.haml b/app/views/users/_overview.html.haml
index 3649f72c956..597e7c37388 100644
--- a/app/views/users/_overview.html.haml
+++ b/app/views/users/_overview.html.haml
@@ -1,4 +1,4 @@
-- activity_pane_class = Feature.enabled?(:security_auto_fix) && @user.bot? ? "col-12" : "col-md-12 col-lg-6"
+- activity_pane_class = Feature.enabled?(:security_auto_fix) && @user.bot? ? "col-12" : "col-md-12 col-lg-6 gl-align-self-start"
.row.d-none.d-sm-flex
.col-12.calendar-block.gl-my-3
@@ -33,7 +33,7 @@
%h4.gl-flex-grow-1
= Feature.enabled?(:security_auto_fix) && @user.bot? ? s_('UserProfile|Bot activity') : s_('UserProfile|Activity')
= link_to s_('UserProfile|View all'), user_activity_path, class: "hide js-view-all"
- .overview-content-list{ data: { href: user_activity_path, testid: 'user-activity-content' } }
+ .overview-content-list.user-activity-content{ data: { href: user_activity_path, testid: 'user-activity-content' } }
= gl_loading_icon(size: 'md', css_class: 'loading')
- unless Feature.enabled?(:security_auto_fix) && @user.bot?
diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml
index 16b69a4298b..c4a55a7d7ed 100644
--- a/app/views/users/show.html.haml
+++ b/app/views/users/show.html.haml
@@ -171,13 +171,15 @@
- if profile_tab?(:activity)
#activity.tab-pane
- .flash-container
- - if can?(current_user, :read_cross_project)
- %h4.prepend-top-20
- = s_('UserProfile|Most Recent Activity')
- .content_list{ data: { href: user_activity_path } }
- .loading
- = gl_loading_icon(size: 'md')
+ .row
+ .col-12
+ .flash-container
+ - if can?(current_user, :read_cross_project)
+ %h4.prepend-top-20
+ = s_('UserProfile|Most Recent Activity')
+ .content_list.user-activity-content{ data: { href: user_activity_path } }
+ .loading
+ = gl_loading_icon(size: 'md')
- unless @user.bot?
- if profile_tab?(:groups)
#groups.tab-pane
diff --git a/app/workers/concerns/gitlab/github_import/stage_methods.rb b/app/workers/concerns/gitlab/github_import/stage_methods.rb
index 1414ff8d6bd..5c63c667a03 100644
--- a/app/workers/concerns/gitlab/github_import/stage_methods.rb
+++ b/app/workers/concerns/gitlab/github_import/stage_methods.rb
@@ -5,6 +5,8 @@ module Gitlab
module StageMethods
extend ActiveSupport::Concern
+ MAX_RETRIES_AFTER_INTERRUPTION = 20
+
included do
include ApplicationWorker
@@ -18,6 +20,29 @@ module Gitlab
end
end
+ class_methods do
+ # We can increase the number of times a GitHubImport::Stage worker is retried
+ # after being interrupted if the importer it executes can restart exactly
+ # from where it left off.
+ #
+ # It is not safe to call this method if the importer loops over its data from
+ # the beginning when restarted, even if it skips data that is already imported
+ # inside the loop, as there is a possibility the importer will never reach
+ # the end of the loop.
+ #
+ # Examples of stage workers that call this method are ones that execute services that:
+ #
+ # - Continue paging an endpoint from where it left off:
+ # https://gitlab.com/gitlab-org/gitlab/-/blob/487521cc/lib/gitlab/github_import/parallel_scheduling.rb#L114-117
+ # - Continue their loop from where it left off:
+ # https://gitlab.com/gitlab-org/gitlab/-/blob/024235ec/lib/gitlab/github_import/importer/pull_requests/review_requests_importer.rb#L15
+ def resumes_work_when_interrupted!
+ return unless Feature.enabled?(:github_importer_raise_max_interruptions)
+
+ sidekiq_options max_retries_after_interruption: MAX_RETRIES_AFTER_INTERRUPTION
+ end
+ end
+
# project_id - The ID of the GitLab project to import the data into.
def perform(project_id)
info(project_id, message: 'starting stage')
diff --git a/app/workers/gitlab/github_import/stage/import_attachments_worker.rb b/app/workers/gitlab/github_import/stage/import_attachments_worker.rb
index f9952f04e99..6f8190fc7e6 100644
--- a/app/workers/gitlab/github_import/stage/import_attachments_worker.rb
+++ b/app/workers/gitlab/github_import/stage/import_attachments_worker.rb
@@ -11,6 +11,8 @@ module Gitlab
include GithubImport::Queue
include StageMethods
+ resumes_work_when_interrupted!
+
# client - An instance of Gitlab::GithubImport::Client.
# project - An instance of Project.
def import(client, project)
diff --git a/app/workers/gitlab/github_import/stage/import_issue_events_worker.rb b/app/workers/gitlab/github_import/stage/import_issue_events_worker.rb
index c80412d941b..77d286dc466 100644
--- a/app/workers/gitlab/github_import/stage/import_issue_events_worker.rb
+++ b/app/workers/gitlab/github_import/stage/import_issue_events_worker.rb
@@ -11,6 +11,8 @@ module Gitlab
include GithubImport::Queue
include StageMethods
+ resumes_work_when_interrupted!
+
# client - An instance of Gitlab::GithubImport::Client.
# project - An instance of Project.
def import(client, project)
diff --git a/app/workers/gitlab/github_import/stage/import_issues_and_diff_notes_worker.rb b/app/workers/gitlab/github_import/stage/import_issues_and_diff_notes_worker.rb
index 592b789cc94..e70f10e3ce9 100644
--- a/app/workers/gitlab/github_import/stage/import_issues_and_diff_notes_worker.rb
+++ b/app/workers/gitlab/github_import/stage/import_issues_and_diff_notes_worker.rb
@@ -11,6 +11,8 @@ module Gitlab
include GithubImport::Queue
include StageMethods
+ resumes_work_when_interrupted!
+
# client - An instance of Gitlab::GithubImport::Client.
# project - An instance of Project.
def import(client, project)
diff --git a/app/workers/gitlab/github_import/stage/import_lfs_objects_worker.rb b/app/workers/gitlab/github_import/stage/import_lfs_objects_worker.rb
index e89a850c991..9db72de59b7 100644
--- a/app/workers/gitlab/github_import/stage/import_lfs_objects_worker.rb
+++ b/app/workers/gitlab/github_import/stage/import_lfs_objects_worker.rb
@@ -11,6 +11,11 @@ module Gitlab
include GithubImport::Queue
include StageMethods
+ # Importer::LfsObjectsImporter can resume work when interrupted as
+ # it uses Projects::LfsPointers::LfsObjectDownloadListService which excludes LFS objects that already exist.
+ # https://gitlab.com/gitlab-org/gitlab/-/blob/eabf0800/app/services/projects/lfs_pointers/lfs_object_download_list_service.rb#L69-71
+ resumes_work_when_interrupted!
+
def perform(project_id)
return unless (project = find_project(project_id))
diff --git a/app/workers/gitlab/github_import/stage/import_notes_worker.rb b/app/workers/gitlab/github_import/stage/import_notes_worker.rb
index c1fdb76d03e..8e88034ba15 100644
--- a/app/workers/gitlab/github_import/stage/import_notes_worker.rb
+++ b/app/workers/gitlab/github_import/stage/import_notes_worker.rb
@@ -11,6 +11,8 @@ module Gitlab
include GithubImport::Queue
include StageMethods
+ resumes_work_when_interrupted!
+
# client - An instance of Gitlab::GithubImport::Client.
# project - An instance of Project.
def import(client, project)
diff --git a/app/workers/gitlab/github_import/stage/import_pull_requests_merged_by_worker.rb b/app/workers/gitlab/github_import/stage/import_pull_requests_merged_by_worker.rb
index 889f938318f..376581c633f 100644
--- a/app/workers/gitlab/github_import/stage/import_pull_requests_merged_by_worker.rb
+++ b/app/workers/gitlab/github_import/stage/import_pull_requests_merged_by_worker.rb
@@ -11,6 +11,8 @@ module Gitlab
include GithubImport::Queue
include StageMethods
+ resumes_work_when_interrupted!
+
# client - An instance of Gitlab::GithubImport::Client.
# project - An instance of Project.
def import(client, project)
diff --git a/app/workers/gitlab/github_import/stage/import_pull_requests_review_requests_worker.rb b/app/workers/gitlab/github_import/stage/import_pull_requests_review_requests_worker.rb
index 44cd7cdb9d1..f2907006d9c 100644
--- a/app/workers/gitlab/github_import/stage/import_pull_requests_review_requests_worker.rb
+++ b/app/workers/gitlab/github_import/stage/import_pull_requests_review_requests_worker.rb
@@ -11,6 +11,8 @@ module Gitlab
include GithubImport::Queue
include StageMethods
+ resumes_work_when_interrupted!
+
# client - An instance of Gitlab::GithubImport::Client.
# project - An instance of Project.
def import(client, project)
diff --git a/app/workers/gitlab/github_import/stage/import_pull_requests_reviews_worker.rb b/app/workers/gitlab/github_import/stage/import_pull_requests_reviews_worker.rb
index 9947a89b92c..5c516555387 100644
--- a/app/workers/gitlab/github_import/stage/import_pull_requests_reviews_worker.rb
+++ b/app/workers/gitlab/github_import/stage/import_pull_requests_reviews_worker.rb
@@ -11,6 +11,8 @@ module Gitlab
include GithubImport::Queue
include StageMethods
+ resumes_work_when_interrupted!
+
# client - An instance of Gitlab::GithubImport::Client.
# project - An instance of Project.
def import(client, project)
diff --git a/app/workers/gitlab/github_import/stage/import_pull_requests_worker.rb b/app/workers/gitlab/github_import/stage/import_pull_requests_worker.rb
index 9bdf3a31776..50527dfa2d8 100644
--- a/app/workers/gitlab/github_import/stage/import_pull_requests_worker.rb
+++ b/app/workers/gitlab/github_import/stage/import_pull_requests_worker.rb
@@ -11,6 +11,8 @@ module Gitlab
include GithubImport::Queue
include StageMethods
+ resumes_work_when_interrupted!
+
# client - An instance of Gitlab::GithubImport::Client.
# project - An instance of Project.
def import(client, project)