Automatically close merge requests that were locker for 1 day
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
parent
b23f71ec4d
commit
6487419364
3 changed files with 13 additions and 2 deletions
|
@ -225,6 +225,11 @@ class Projects::MergeRequestsController < Projects::ApplicationController
|
||||||
@allowed_to_merge = allowed_to_merge?
|
@allowed_to_merge = allowed_to_merge?
|
||||||
@show_merge_controls = @merge_request.open? && @commits.any? && @allowed_to_merge
|
@show_merge_controls = @merge_request.open? && @commits.any? && @allowed_to_merge
|
||||||
@source_branch = @merge_request.source_project.repository.find_branch(@merge_request.source_branch).try(:name)
|
@source_branch = @merge_request.source_project.repository.find_branch(@merge_request.source_branch).try(:name)
|
||||||
|
|
||||||
|
if @merge_request.locked_long_ago?
|
||||||
|
@merge_request.unlock_mr
|
||||||
|
@merge_request.close
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def allowed_to_merge?
|
def allowed_to_merge?
|
||||||
|
|
|
@ -346,4 +346,8 @@ class MergeRequest < ActiveRecord::Base
|
||||||
source_project.repository.branch_names
|
source_project.repository.branch_names
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def locked_long_ago?
|
||||||
|
locked_at && locked_at < (Time.now - 1.day)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,7 +11,9 @@
|
||||||
|
|
||||||
- if @merge_request.closed?
|
- if @merge_request.closed?
|
||||||
%h4
|
%h4
|
||||||
Closed by #{link_to_member(@project, @merge_request.closed_event.author, avatar: false)}
|
Closed
|
||||||
|
- if @merge_request.closed_event
|
||||||
|
by #{link_to_member(@project, @merge_request.closed_event.author, avatar: false)}
|
||||||
#{time_ago_with_tooltip(@merge_request.closed_event.created_at)}
|
#{time_ago_with_tooltip(@merge_request.closed_event.created_at)}
|
||||||
%p Changes were not merged into target branch
|
%p Changes were not merged into target branch
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue