diff options
author | Adam Butler <adam@littlebigmedia.co.uk> | 2016-04-06 20:37:09 +0100 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-05-18 11:15:10 -0500 |
commit | 8a8b5497c5142f225fb4fa3f5441526a0652869a (patch) | |
tree | d93b1a519d0454139e4cc1c51150d51ccd7af8d8 /app/services | |
parent | 636b3ebb011d7bc58c70a642c7b6920ab99c0b6d (diff) | |
download | gitlab-ce-8a8b5497c5142f225fb4fa3f5441526a0652869a.tar.gz |
Create DiffFilter and change SystemNoteService#change_title to use Gitlab::Diff::InlineDiff
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/system_note_service.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/app/services/system_note_service.rb b/app/services/system_note_service.rb index 4bdb1b0c074..758abd7f547 100644 --- a/app/services/system_note_service.rb +++ b/app/services/system_note_service.rb @@ -171,7 +171,14 @@ class SystemNoteService def self.change_title(noteable, project, author, old_title) return unless noteable.respond_to?(: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 |