Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
acf9778e
Commit
acf9778e
authored
Feb 26, 2016
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use specialized system notes when MR is (un)marked as WIP
parent
01160fc0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
1 deletion
+36
-1
CHANGELOG
CHANGELOG
+1
-0
app/models/merge_request.rb
app/models/merge_request.rb
+7
-1
app/services/merge_requests/base_service.rb
app/services/merge_requests/base_service.rb
+16
-0
app/services/system_note_service.rb
app/services/system_note_service.rb
+12
-0
No files found.
CHANGELOG
View file @
acf9778e
...
@@ -3,6 +3,7 @@ Please view this file on the master branch, on stable branches it's out of date.
...
@@ -3,6 +3,7 @@ Please view this file on the master branch, on stable branches it's out of date.
v 8.6.0 (unreleased)
v 8.6.0 (unreleased)
- Improve the formatting for the user page bio (Connor Shea)
- Improve the formatting for the user page bio (Connor Shea)
- Fix avatar stretching by providing a cropping feature (Johann Pardanaud)
- Fix avatar stretching by providing a cropping feature (Johann Pardanaud)
- Use specialized system notes when MR is (un)marked as WIP
v 8.5.1
v 8.5.1
- Fix group projects styles
- Fix group projects styles
...
...
app/models/merge_request.rb
View file @
acf9778e
...
@@ -259,8 +259,14 @@ class MergeRequest < ActiveRecord::Base
...
@@ -259,8 +259,14 @@ class MergeRequest < ActiveRecord::Base
self
.
target_project
.
events
.
where
(
target_id:
self
.
id
,
target_type:
"MergeRequest"
,
action:
Event
::
CLOSED
).
last
self
.
target_project
.
events
.
where
(
target_id:
self
.
id
,
target_type:
"MergeRequest"
,
action:
Event
::
CLOSED
).
last
end
end
WIP_REGEX
=
/\A\[?WIP(\]|:| )\s*/i
.
freeze
def
work_in_progress?
def
work_in_progress?
!!
(
title
=~
/\A\[?WIP(\]|:| )/i
)
title
=~
WIP_REGEX
end
def
wipless_title
self
.
title
.
sub
(
WIP_REGEX
,
""
)
end
end
def
mergeable?
def
mergeable?
...
...
app/services/merge_requests/base_service.rb
View file @
acf9778e
...
@@ -5,6 +5,22 @@ module MergeRequests
...
@@ -5,6 +5,22 @@ module MergeRequests
SystemNoteService
.
change_status
(
merge_request
,
merge_request
.
target_project
,
current_user
,
merge_request
.
state
,
nil
)
SystemNoteService
.
change_status
(
merge_request
,
merge_request
.
target_project
,
current_user
,
merge_request
.
state
,
nil
)
end
end
def
create_title_change_note
(
issuable
,
old_title
)
wipless_old_title
=
old_title
.
sub
(
MergeRequest
::
WIP_REGEX
,
""
)
wipless_new_title
=
issuable
.
title
.
sub
(
MergeRequest
::
WIP_REGEX
,
""
)
removed_wip
=
wipless_old_title
==
issuable
.
title
added_wip
=
wipless_new_title
==
old_title
if
removed_wip
SystemNoteService
.
remove_merge_request_wip
(
issuable
,
issuable
.
project
,
current_user
)
elsif
added_wip
SystemNoteService
.
add_merge_request_wip
(
issuable
,
issuable
.
project
,
current_user
)
else
super
end
end
def
hook_data
(
merge_request
,
action
)
def
hook_data
(
merge_request
,
action
)
hook_data
=
merge_request
.
to_hook_data
(
current_user
)
hook_data
=
merge_request
.
to_hook_data
(
current_user
)
merge_request_url
=
Gitlab
::
UrlBuilder
.
new
(
:merge_request
).
build
(
merge_request
.
id
)
merge_request_url
=
Gitlab
::
UrlBuilder
.
new
(
:merge_request
).
build
(
merge_request
.
id
)
...
...
app/services/system_note_service.rb
View file @
acf9778e
...
@@ -144,6 +144,18 @@ class SystemNoteService
...
@@ -144,6 +144,18 @@ class SystemNoteService
create_note
(
noteable:
noteable
,
project:
project
,
author:
author
,
note:
body
)
create_note
(
noteable:
noteable
,
project:
project
,
author:
author
,
note:
body
)
end
end
def
self
.
remove_merge_request_wip
(
noteable
,
project
,
author
)
body
=
'Unmarked this merge request as Work In Progress'
create_note
(
noteable:
noteable
,
project:
project
,
author:
author
,
note:
body
)
end
def
self
.
add_merge_request_wip
(
noteable
,
project
,
author
)
body
=
'Marked this merge request as **Work In Progress**'
create_note
(
noteable:
noteable
,
project:
project
,
author:
author
,
note:
body
)
end
# Called when the title of a Noteable is changed
# Called when the title of a Noteable is changed
#
#
# noteable - Noteable object that responds to `title`
# noteable - Noteable object that responds to `title`
...
...
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