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>2022-05-19 10:33:21 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-05-19 10:33:21 +0300
commit36a59d088eca61b834191dacea009677a96c052f (patch)
treee4f33972dab5d8ef79e3944a9f403035fceea43f /app/services/system_notes
parenta1761f15ec2cae7c7f7bbda39a75494add0dfd6f (diff)
Add latest changes from gitlab-org/gitlab@15-0-stable-eev15.0.0-rc42
Diffstat (limited to 'app/services/system_notes')
-rw-r--r--app/services/system_notes/incidents_service.rb40
-rw-r--r--app/services/system_notes/time_tracking_service.rb12
2 files changed, 52 insertions, 0 deletions
diff --git a/app/services/system_notes/incidents_service.rb b/app/services/system_notes/incidents_service.rb
new file mode 100644
index 00000000000..d5da684a2d8
--- /dev/null
+++ b/app/services/system_notes/incidents_service.rb
@@ -0,0 +1,40 @@
+# frozen_string_literal: true
+
+module SystemNotes
+ class IncidentsService < ::SystemNotes::BaseService
+ CHANGED_TEXT = {
+ occurred_at: 'the event time/date on ',
+ note: 'the text on ',
+ occurred_at_and_note: 'the event time/date and text on '
+ }.freeze
+
+ def initialize(noteable:)
+ @noteable = noteable
+ @project = noteable.project
+ end
+
+ def add_timeline_event(timeline_event)
+ author = timeline_event.author
+ anchor = "timeline_event_#{timeline_event.id}"
+ path = url_helpers.project_issues_incident_path(project, noteable, anchor: anchor)
+ body = "added an [incident timeline event](#{path})"
+
+ create_note(NoteSummary.new(noteable, project, author, body, action: 'timeline_event'))
+ end
+
+ def edit_timeline_event(timeline_event, author, was_changed:)
+ anchor = "timeline_event_#{timeline_event.id}"
+ path = url_helpers.project_issues_incident_path(project, noteable, anchor: anchor)
+ changed_text = CHANGED_TEXT.fetch(was_changed, '')
+ body = "edited #{changed_text}[incident timeline event](#{path})"
+
+ create_note(NoteSummary.new(noteable, project, author, body, action: 'timeline_event'))
+ end
+
+ def delete_timeline_event(author)
+ body = 'deleted an incident timeline event'
+
+ create_note(NoteSummary.new(noteable, project, author, body, action: 'timeline_event'))
+ end
+ end
+end
diff --git a/app/services/system_notes/time_tracking_service.rb b/app/services/system_notes/time_tracking_service.rb
index a804a06fe4c..a9b1f6d3d37 100644
--- a/app/services/system_notes/time_tracking_service.rb
+++ b/app/services/system_notes/time_tracking_service.rb
@@ -76,6 +76,18 @@ module SystemNotes
create_note(NoteSummary.new(noteable, project, author, body, action: 'time_tracking'))
end
+ def remove_timelog(timelog)
+ time_spent = timelog.time_spent
+ spent_at = timelog.spent_at&.to_date
+
+ parsed_time = Gitlab::TimeTrackingFormatter.output(time_spent)
+
+ body = "deleted #{parsed_time} of spent time"
+ body += " from #{spent_at}" if spent_at
+
+ create_note(NoteSummary.new(noteable, project, author, body, action: 'time_tracking'))
+ end
+
private
def issue_activity_counter