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/timelogs/create_service.rb')
-rw-r--r--app/services/timelogs/create_service.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/app/services/timelogs/create_service.rb b/app/services/timelogs/create_service.rb
index 19428864fa9..f65f9482d76 100644
--- a/app/services/timelogs/create_service.rb
+++ b/app/services/timelogs/create_service.rb
@@ -37,12 +37,33 @@ module Timelogs
note: nil
)
+ old_associations = { total_time_spent: issuable.total_time_spent }
+
if !timelog.save
error_in_save(timelog)
else
SystemNoteService.created_timelog(issuable, issuable.project, current_user, timelog)
+
+ issuable_base_service.execute_hooks(issuable, 'update', old_associations: old_associations)
+
success(timelog)
end
end
+
+ private
+
+ def issuable_base_service
+ if issuable.is_a?(Issue)
+ Issues::BaseService.new(
+ container: issuable.project,
+ current_user: current_user
+ )
+ else
+ MergeRequests::BaseService.new(
+ project: issuable.project,
+ current_user: current_user
+ )
+ end
+ end
end
end