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:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-05-19 18:44:42 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-05-19 18:44:42 +0300
commit4555e1b21c365ed8303ffb7a3325d773c9b8bf31 (patch)
tree5423a1c7516cffe36384133ade12572cf709398d /app/services/system_notes
parente570267f2f6b326480d284e0164a6464ba4081bc (diff)
Add latest changes from gitlab-org/gitlab@13-12-stable-eev13.12.0-rc42
Diffstat (limited to 'app/services/system_notes')
-rw-r--r--app/services/system_notes/base_service.rb6
-rw-r--r--app/services/system_notes/issuables_service.rb9
-rw-r--r--app/services/system_notes/time_tracking_service.rb4
3 files changed, 11 insertions, 8 deletions
diff --git a/app/services/system_notes/base_service.rb b/app/services/system_notes/base_service.rb
index 7341a25b133..ee7784c127b 100644
--- a/app/services/system_notes/base_service.rb
+++ b/app/services/system_notes/base_service.rb
@@ -13,10 +13,10 @@ module SystemNotes
protected
def create_note(note_summary)
- note = Note.create(note_summary.note.merge(system: true))
- note.system_note_metadata = SystemNoteMetadata.new(note_summary.metadata) if note_summary.metadata?
+ note_params = note_summary.note.merge(system: true)
+ note_params[:system_note_metadata] = SystemNoteMetadata.new(note_summary.metadata) if note_summary.metadata?
- note
+ Note.create(note_params)
end
def content_tag(*args)
diff --git a/app/services/system_notes/issuables_service.rb b/app/services/system_notes/issuables_service.rb
index 60dd56e772a..ae4f65e785c 100644
--- a/app/services/system_notes/issuables_service.rb
+++ b/app/services/system_notes/issuables_service.rb
@@ -178,8 +178,7 @@ module SystemNotes
if noteable.is_a?(ExternalIssue)
noteable.project.external_issue_tracker.create_cross_reference_note(noteable, mentioner, author)
else
- issue_activity_counter.track_issue_cross_referenced_action(author: author) if noteable.is_a?(Issue)
-
+ track_cross_reference_action
create_note(NoteSummary.new(noteable, noteable.project, author, body, action: 'cross_reference'))
end
end
@@ -414,7 +413,11 @@ module SystemNotes
def issue_activity_counter
Gitlab::UsageDataCounters::IssueActivityUniqueCounter
end
+
+ def track_cross_reference_action
+ issue_activity_counter.track_issue_cross_referenced_action(author: author) if noteable.is_a?(Issue)
+ end
end
end
-SystemNotes::IssuablesService.prepend_if_ee('::EE::SystemNotes::IssuablesService')
+SystemNotes::IssuablesService.prepend_mod_with('SystemNotes::IssuablesService')
diff --git a/app/services/system_notes/time_tracking_service.rb b/app/services/system_notes/time_tracking_service.rb
index 650e40680b1..a804a06fe4c 100644
--- a/app/services/system_notes/time_tracking_service.rb
+++ b/app/services/system_notes/time_tracking_service.rb
@@ -62,12 +62,12 @@ module SystemNotes
if time_spent == :reset
body = "removed time spent"
else
- spent_at = noteable.spent_at
+ spent_at = noteable.spent_at&.to_date
parsed_time = Gitlab::TimeTrackingFormatter.output(time_spent.abs)
action = time_spent > 0 ? 'added' : 'subtracted'
text_parts = ["#{action} #{parsed_time} of time spent"]
- text_parts << "at #{spent_at}" if spent_at
+ text_parts << "at #{spent_at}" if spent_at && spent_at != DateTime.current.to_date
body = text_parts.join(' ')
end