diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 14:10:13 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 14:10:13 +0300 |
commit | 0ea3fcec397b69815975647f5e2aa5fe944a8486 (patch) | |
tree | 7979381b89d26011bcf9bdc989a40fcc2f1ed4ff /app/services/system_notes | |
parent | 72123183a20411a36d607d70b12d57c484394c8e (diff) |
Add latest changes from gitlab-org/gitlab@15-1-stable-eev15.1.0-rc42
Diffstat (limited to 'app/services/system_notes')
-rw-r--r-- | app/services/system_notes/issuables_service.rb | 15 | ||||
-rw-r--r-- | app/services/system_notes/merge_requests_service.rb | 2 |
2 files changed, 15 insertions, 2 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 diff --git a/app/services/system_notes/merge_requests_service.rb b/app/services/system_notes/merge_requests_service.rb index 546a23c95c2..7758c1e8597 100644 --- a/app/services/system_notes/merge_requests_service.rb +++ b/app/services/system_notes/merge_requests_service.rb @@ -27,7 +27,7 @@ module SystemNotes end def handle_merge_request_draft - action = noteable.work_in_progress? ? "draft" : "ready" + action = noteable.draft? ? "draft" : "ready" body = "marked this merge request as **#{action}**" |