summaryrefslogtreecommitdiff
path: root/app/models/push_event.rb
diff options
context:
space:
mode:
authorDrew Blessing <drew@gitlab.com>2017-12-04 13:00:57 -0600
committerDrew Blessing <drew@gitlab.com>2018-01-15 16:45:56 -0600
commit38e9e934f49115021614b66353bbac459b6b70bb (patch)
tree4781a6052478f9197604b78533e6dec0ac4d372a /app/models/push_event.rb
parent4b99bee09602ea0cb950347187b5fdf6d39603b8 (diff)
downloadgitlab-ce-38e9e934f49115021614b66353bbac459b6b70bb.tar.gz
Last push widget will show banner for new pushes to previously merged branch
Previously, the last push widget would only show when the branch never had a merge request associated with it - even merged or closed ones. Now the widget will disregard merge requests that are merged or closed.
Diffstat (limited to 'app/models/push_event.rb')
-rw-r--r--app/models/push_event.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/models/push_event.rb b/app/models/push_event.rb
index 83ce9014094..90c085c888e 100644
--- a/app/models/push_event.rb
+++ b/app/models/push_event.rb
@@ -46,10 +46,11 @@ class PushEvent < Event
# Returns PushEvent instances for which no merge requests have been created.
def self.without_existing_merge_requests
- existing_mrs = MergeRequest.except(:order)
+ existing_mrs = MergeRequest.except(:order, :where)
.select(1)
.where('merge_requests.source_project_id = events.project_id')
.where('merge_requests.source_branch = push_event_payloads.ref')
+ .where(state: :opened)
# For reasons unknown the use of #eager_load will result in the
# "push_event_payload" association not being set. Because of this we're