diff options
author | Rémy Coutable <remy@rymai.me> | 2016-05-18 12:56:13 -0500 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-05-18 17:43:40 -0500 |
commit | 0698113cabe68f23ac38d7b2fde6c5cb7e5bec4f (patch) | |
tree | 8c24a7da49c82d28079d9e3d69f68c77a61e37ce /app/services | |
parent | 483c034b86262fb9b2c47df999d995f500b38eb4 (diff) | |
download | gitlab-ce-0698113cabe68f23ac38d7b2fde6c5cb7e5bec4f.tar.gz |
Move #create_confidentiality_note to Issues::UpdateServicemooreniemi/gitlab-ce-issue_15236
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/issuable_base_service.rb | 6 | ||||
-rw-r--r-- | app/services/issues/update_service.rb | 8 | ||||
-rw-r--r-- | app/services/system_note_service.rb | 19 |
3 files changed, 14 insertions, 19 deletions
diff --git a/app/services/issuable_base_service.rb b/app/services/issuable_base_service.rb index 1f59281e271..2b16089df1b 100644 --- a/app/services/issuable_base_service.rb +++ b/app/services/issuable_base_service.rb @@ -36,12 +36,6 @@ class IssuableBaseService < BaseService end end - def create_confidentiality_note(issuable) - SystemNoteService.change_confidentiality( - issuable, issuable.project, current_user - ) - end - def filter_params(issuable_ability_name = :issue) filter_assignee filter_milestone diff --git a/app/services/issues/update_service.rb b/app/services/issues/update_service.rb index 3a9bbf8a78c..c7d406cc331 100644 --- a/app/services/issues/update_service.rb +++ b/app/services/issues/update_service.rb @@ -10,7 +10,7 @@ module Issues end if issue.previous_changes.include?('title') || - issue.previous_changes.include?('description') + issue.previous_changes.include?('description') todo_service.update_issue(issue, current_user) end @@ -41,5 +41,11 @@ module Issues def close_service Issues::CloseService end + + private + + def create_confidentiality_note(issue) + SystemNoteService.change_issue_confidentiality(issue, issue.project, current_user) + end end end diff --git a/app/services/system_note_service.rb b/app/services/system_note_service.rb index e9e3c472e6d..972f8b2012d 100644 --- a/app/services/system_note_service.rb +++ b/app/services/system_note_service.rb @@ -169,29 +169,24 @@ class SystemNoteService # # Returns the created Note object def self.change_title(noteable, project, author, old_title) - return unless noteable.respond_to?(:title) - body = "Title changed from **#{old_title}** to **#{noteable.title}**" create_note(noteable: noteable, project: project, author: author, note: body) end # Called when the confidentiality changes # - # noteable - Noteable object that responds to 'confidential' - # project - Project owning noteable - # author - User performing the change + # issue - Issue object + # project - Project owning the issue + # author - User performing the change # # Example Note text: # - # "Marked as confidential" + # "Made the issue confidential" # # Returns the created Note object - def self.change_confidentiality(noteable, project, author) - return unless noteable.respond_to?(:confidential) - - confidentiality_status = noteable.confidential ? "confidential" : "not confidential" - body = "Marked as #{confidentiality_status}" - create_note(noteable: noteable, project: project, author: author, note: body) + def self.change_issue_confidentiality(issue, project, author) + body = issue.confidential ? 'Made the issue confidential' : 'Made the issue visible' + create_note(noteable: issue, project: project, author: author, note: body) end # Called when a branch in Noteable is changed |