BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
64874193
Unverified
Commit
64874193
authored
Dec 05, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Automatically close merge requests that were locker for 1 day
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
b23f71ec
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
2 deletions
+13
-2
merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+5
-0
merge_request.rb
app/models/merge_request.rb
+4
-0
_state_widget.html.haml
...iews/projects/merge_requests/show/_state_widget.html.haml
+4
-2
No files found.
app/controllers/projects/merge_requests_controller.rb
View file @
64874193
...
...
@@ -225,6 +225,11 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@allowed_to_merge
=
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
)
if
@merge_request
.
locked_long_ago?
@merge_request
.
unlock_mr
@merge_request
.
close
end
end
def
allowed_to_merge?
...
...
app/models/merge_request.rb
View file @
64874193
...
...
@@ -346,4 +346,8 @@ class MergeRequest < ActiveRecord::Base
source_project
.
repository
.
branch_names
end
end
def
locked_long_ago?
locked_at
&&
locked_at
<
(
Time
.
now
-
1
.
day
)
end
end
app/views/projects/merge_requests/show/_state_widget.html.haml
View file @
64874193
...
...
@@ -11,8 +11,10 @@
-
if
@merge_request
.
closed?
%h4
Closed by
#{
link_to_member
(
@project
,
@merge_request
.
closed_event
.
author
,
avatar:
false
)
}
#{
time_ago_with_tooltip
(
@merge_request
.
closed_event
.
created_at
)
}
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
)
}
%p
Changes were not merged into target branch
-
if
@merge_request
.
merged?
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment