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:
authorDouwe Maan <douwe@selenight.nl>2016-05-21 00:23:04 +0300
committerDouwe Maan <douwe@selenight.nl>2016-05-21 00:23:04 +0300
commitfc1910ddc5db25e608921f69c3dc28d830e6ea03 (patch)
tree1f82bd43de18fdb6ec1d01801d7d75c08bdf7928 /app/services/system_note_service.rb
parent63f53730c0483b4c9e6fa9d90413d40a8c74a243 (diff)
parent5341b16fc92425d557a1c62d0329b276170eba73 (diff)
Merge branch 'adambutler/gitlab-ce-feature/support-diff-of-issue-title-rename'
# Conflicts: # app/services/system_note_service.rb
Diffstat (limited to 'app/services/system_note_service.rb')
-rw-r--r--app/services/system_note_service.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/app/services/system_note_service.rb b/app/services/system_note_service.rb
index 972f8b2012d..4e8fa0818b9 100644
--- a/app/services/system_note_service.rb
+++ b/app/services/system_note_service.rb
@@ -169,7 +169,14 @@ class SystemNoteService
#
# Returns the created Note object
def self.change_title(noteable, project, author, old_title)
- body = "Title changed from **#{old_title}** to **#{noteable.title}**"
+ new_title = noteable.title.dup
+
+ old_diffs, new_diffs = Gitlab::Diff::InlineDiff.new(old_title, new_title).inline_diffs
+
+ marked_old_title = Gitlab::Diff::InlineDiffMarker.new(old_title).mark(old_diffs, mode: :deletion, markdown: true)
+ marked_new_title = Gitlab::Diff::InlineDiffMarker.new(new_title).mark(new_diffs, mode: :addition, markdown: true)
+
+ body = "Changed title: **#{marked_old_title}** → **#{marked_new_title}**"
create_note(noteable: noteable, project: project, author: author, note: body)
end