diff options
author | Rémy Coutable <remy@rymai.me> | 2016-03-19 01:27:35 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-03-19 01:27:35 +0300 |
commit | 0b942541da1dc616cea266dc1f4d517fe81f6e5a (patch) | |
tree | 9b103ba9425031151b5629dc6f0ce8ae7298e7d3 /app/services | |
parent | d4b49587b9f7279362641d4b6cfabd093e21d629 (diff) |
Improve the "easy WIP & un-WIP from link" feature
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/merge_requests/base_service.rb | 7 | ||||
-rw-r--r-- | app/services/system_note_service.rb | 4 |
2 files changed, 4 insertions, 7 deletions
diff --git a/app/services/merge_requests/base_service.rb b/app/services/merge_requests/base_service.rb index 9370b4c01a6..ac5b58db862 100644 --- a/app/services/merge_requests/base_service.rb +++ b/app/services/merge_requests/base_service.rb @@ -6,11 +6,8 @@ module MergeRequests 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 + removed_wip = old_title =~ MergeRequest::WIP_REGEX && !issuable.work_in_progress? + added_wip = old_title !~ MergeRequest::WIP_REGEX && issuable.work_in_progress? if removed_wip SystemNoteService.remove_merge_request_wip(issuable, issuable.project, current_user) diff --git a/app/services/system_note_service.rb b/app/services/system_note_service.rb index e579ca76565..2404ac2ff4c 100644 --- a/app/services/system_note_service.rb +++ b/app/services/system_note_service.rb @@ -145,13 +145,13 @@ class SystemNoteService end def self.remove_merge_request_wip(noteable, project, author) - body = 'Unmarked this merge request as Work In Progress' + body = 'Unmarked this merge request as a 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**' + body = 'Marked this merge request as a **Work In Progress**' create_note(noteable: noteable, project: project, author: author, note: body) end |