diff options
author | Rémy Coutable <remy@rymai.me> | 2018-01-12 15:47:50 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-01-12 15:47:50 +0000 |
commit | 6438a1afa7f260da3d7de85c4986042bdf56c84e (patch) | |
tree | 8cafbac3f0f635ced7c1f3b28b537987ab228355 /app/models/merge_request.rb | |
parent | 3b029de094f58e18b955bf472ccaff93de70d3bd (diff) | |
parent | f3cf8cc8d1625ae1cd532474191739cd36419425 (diff) | |
download | gitlab-ce-6438a1afa7f260da3d7de85c4986042bdf56c84e.tar.gz |
Merge branch '41807-15665-consistently-502s-because-it-fetches-every-commit' into 'master'41988-updating-the-markdown-cache-version-does-not-flush-the-appearances-cache
Resolve "!15665 consistently 502s because it fetches every commit"
Closes #41807
See merge request gitlab-org/gitlab-ce!16320
Diffstat (limited to 'app/models/merge_request.rb')
-rw-r--r-- | app/models/merge_request.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 2669d2a6ff3..b7762a5f281 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -982,7 +982,16 @@ class MergeRequest < ActiveRecord::Base end def can_be_reverted?(current_user) - merge_commit && !merge_commit.has_been_reverted?(current_user, self) + return false unless merge_commit + + merged_at = metrics&.merged_at + notes_association = notes_with_associations + + if merged_at + notes_association = notes_association.where('created_at > ?', merged_at) + end + + !merge_commit.has_been_reverted?(current_user, notes_association) end def can_be_cherry_picked? |