Commit 1a0082b4 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

hime last push widget if user already has MR created

parent 65f0ed4d
......@@ -137,13 +137,21 @@ module ApplicationHelper
end
end
# Define whenever show last push event
# with suggestion to create MR
def show_last_push_widget?(event)
event &&
event.last_push_to_non_root? &&
!event.rm_ref? &&
event.project &&
event.project.repository &&
event.project.merge_requests_enabled
# Skip if event is not about added or modified non-master branch
return false unless event && event.last_push_to_non_root? && !event.rm_ref?
project = event.project
# Skip if project repo is empty or MR disabled
return false unless project && !project.empty_repo? && project.merge_requests_enabled
# Skip if user already created appropriate MR
return false if project.merge_requests.where(source_branch: event.branch_name).opened.any?
true
end
def hexdigest(string)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment