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:
Diffstat (limited to 'app/services/system_notes/issuables_service.rb')
-rw-r--r--app/services/system_notes/issuables_service.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/app/services/system_notes/issuables_service.rb b/app/services/system_notes/issuables_service.rb
index 89212288a6b..f9e5c3725d8 100644
--- a/app/services/system_notes/issuables_service.rb
+++ b/app/services/system_notes/issuables_service.rb
@@ -2,6 +2,18 @@
module SystemNotes
class IssuablesService < ::SystemNotes::BaseService
+ # We create cross-referenced system notes when a commit relates to an issue.
+ # There are two options what time to use for the system note:
+ # 1. The push date (default)
+ # 2. The commit date
+ #
+ # The commit date is useful when an existing Git repository is imported to GitLab.
+ # It helps to preserve an original order of all notes (comments, commits, status changes, e.t.c)
+ # in the imported issues. Otherwise, all commits will be linked before or after all other imported notes.
+ #
+ # See also the discussion in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/60700#note_612724683
+ USE_COMMIT_DATE_FOR_CROSS_REFERENCE_NOTE = false
+
#
# noteable_ref - Referenced noteable object
#
@@ -216,7 +228,8 @@ module SystemNotes
)
else
track_cross_reference_action
- create_note(NoteSummary.new(noteable, noteable.project, author, body, action: 'cross_reference'))
+ created_at = mentioner.created_at if USE_COMMIT_DATE_FOR_CROSS_REFERENCE_NOTE && mentioner.is_a?(Commit)
+ create_note(NoteSummary.new(noteable, noteable.project, author, body, action: 'cross_reference', created_at: created_at))
end
end