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')
-rw-r--r--app/services/timelogs/base_service.rb4
-rw-r--r--app/services/timelogs/create_service.rb3
2 files changed, 5 insertions, 2 deletions
diff --git a/app/services/timelogs/base_service.rb b/app/services/timelogs/base_service.rb
index e09264864fd..712a0a4f128 100644
--- a/app/services/timelogs/base_service.rb
+++ b/app/services/timelogs/base_service.rb
@@ -22,9 +22,9 @@ module Timelogs
end
def error_in_save(timelog)
- return error(_("Failed to save timelog")) if timelog.errors.empty?
+ return error(_("Failed to save timelog"), 404) if timelog.errors.empty?
- error(timelog.errors.full_messages.to_sentence)
+ error(timelog.errors.full_messages.to_sentence, 404)
end
end
end
diff --git a/app/services/timelogs/create_service.rb b/app/services/timelogs/create_service.rb
index 12181cec20a..19428864fa9 100644
--- a/app/services/timelogs/create_service.rb
+++ b/app/services/timelogs/create_service.rb
@@ -21,6 +21,9 @@ module Timelogs
}, 404)
end
+ return error(_("Spent at can't be a future date and time."), 404) if spent_at.future?
+ return error(_("Time spent can't be zero."), 404) if time_spent == 0
+
issue = issuable if issuable.is_a?(Issue)
merge_request = issuable if issuable.is_a?(MergeRequest)