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
path: root/app
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2018-01-29 13:49:14 +0300
committerSean McGivern <sean@gitlab.com>2018-01-29 13:49:14 +0300
commitf0df45fb8a79056c81da659678be571329831cff (patch)
treeb2dd8d46fec45bb9e613076e295dea1df05c3ff8 /app
parentf8dd398a21b19cb7d5609260fcc18b0ce2bd617a (diff)
Fix MR revert check when no merged_at is present
Diffstat (limited to 'app')
-rw-r--r--app/models/merge_request.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb
index 4accb08eaf9..f6d4843abc3 100644
--- a/app/models/merge_request.rb
+++ b/app/models/merge_request.rb
@@ -989,13 +989,13 @@ class MergeRequest < ActiveRecord::Base
merged_at = metrics&.merged_at
notes_association = notes_with_associations
- # It is not guaranteed that Note#created_at will be strictly later than
- # MergeRequestMetric#merged_at. Nanoseconds on MySQL may break this
- # comparison, as will a HA environment if clocks are not *precisely*
- # synchronized. Add a minute's leeway to compensate for both possibilities
- cutoff = merged_at - 1.minute
-
if merged_at
+ # It is not guaranteed that Note#created_at will be strictly later than
+ # MergeRequestMetric#merged_at. Nanoseconds on MySQL may break this
+ # comparison, as will a HA environment if clocks are not *precisely*
+ # synchronized. Add a minute's leeway to compensate for both possibilities
+ cutoff = merged_at - 1.minute
+
notes_association = notes_association.where('created_at >= ?', cutoff)
end