Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Moore-Niemi <moore.niemi@gmail.com>2016-04-21 01:41:11 +0300
committerRémy Coutable <remy@rymai.me>2016-05-18 08:27:31 +0300
commit483c034b86262fb9b2c47df999d995f500b38eb4 (patch)
treed219b5f28b0ac95b7efde08ac2dac43bd3b942b2 /app/services/system_note_service.rb
parentda8ac1635f1c12e9455e7517bee29678c754d492 (diff)
Changing the confidentiality of an issue now creates a new system note
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'app/services/system_note_service.rb')
-rw-r--r--app/services/system_note_service.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/app/services/system_note_service.rb b/app/services/system_note_service.rb
index 4bdb1b0c074..e9e3c472e6d 100644
--- a/app/services/system_note_service.rb
+++ b/app/services/system_note_service.rb
@@ -175,6 +175,25 @@ class SystemNoteService
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
+ #
+ # Example Note text:
+ #
+ # "Marked as 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)
+ end
+
# Called when a branch in Noteable is changed
#
# noteable - Noteable object