diff options
author | Douwe Maan <douwe@selenight.nl> | 2016-02-27 06:34:14 +0300 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2016-02-27 06:34:14 +0300 |
commit | acf9778e77e5d6e36cb3eb750e88adaa5881a94a (patch) | |
tree | b50ec601a245819389d7c8977de7e6f843789ff7 /app/services/merge_requests/base_service.rb | |
parent | 01160fc06182de89c400af174861f6545ad6ceb8 (diff) |
Use specialized system notes when MR is (un)marked as WIP
Diffstat (limited to 'app/services/merge_requests/base_service.rb')
-rw-r--r-- | app/services/merge_requests/base_service.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/app/services/merge_requests/base_service.rb b/app/services/merge_requests/base_service.rb index 7b306a8a531..9370b4c01a6 100644 --- a/app/services/merge_requests/base_service.rb +++ b/app/services/merge_requests/base_service.rb @@ -5,6 +5,22 @@ module MergeRequests SystemNoteService.change_status(merge_request, merge_request.target_project, current_user, merge_request.state, nil) 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) hook_data = merge_request.to_hook_data(current_user) merge_request_url = Gitlab::UrlBuilder.new(:merge_request).build(merge_request.id) |