diff options
author | Go MAEDA <maeda@farend.jp> | 2019-06-02 13:29:54 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2019-06-02 13:29:54 +0000 |
commit | 2d475288e4b79bea7f3beefd5f0be151510b0274 (patch) | |
tree | acb70f3c9b295b1839587dd400b895d51d007dc4 /app | |
parent | 748e8725d6c93dadfebc94440a0600cdfb890f9a (diff) | |
download | redmine-2d475288e4b79bea7f3beefd5f0be151510b0274.tar.gz redmine-2d475288e4b79bea7f3beefd5f0be151510b0274.zip |
Insert a link to the source to the attribution line when quoting a note or a message (#31427).
Patch by Mizuki ISHIKAWA.
git-svn-id: http://svn.redmine.org/redmine/trunk@18217 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/journals_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/messages_controller.rb | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/app/controllers/journals_controller.rb b/app/controllers/journals_controller.rb index 2ff228998..a0a0352dd 100644 --- a/app/controllers/journals_controller.rb +++ b/app/controllers/journals_controller.rb @@ -66,13 +66,15 @@ class JournalsController < ApplicationController if @journal user = @journal.user text = @journal.notes + indice = @journal.issue.visible_journals_with_index.find{|j| j.id == @journal.id}.indice + @content = +"#{ll(Setting.default_language, :text_user_wrote_in, {:value => user, :link => "#note-#{indice}"})}\n> " else user = @issue.author text = @issue.description + @content = +"#{ll(Setting.default_language, :text_user_wrote, user)}\n> " end # Replaces pre blocks with [...] text = text.to_s.strip.gsub(%r{<pre>(.*?)</pre>}m, '[...]') - @content = +"#{ll(Setting.default_language, :text_user_wrote, user)}\n> " @content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n" rescue ActiveRecord::RecordNotFound render_404 diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index f0830fcdb..b6bcb2839 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -117,7 +117,11 @@ class MessagesController < ApplicationController @subject = @message.subject @subject = "RE: #{@subject}" unless @subject.starts_with?('RE:') - @content = +"#{ll(Setting.default_language, :text_user_wrote, @message.author)}\n> " + if @message.root == @message + @content = +"#{ll(Setting.default_language, :text_user_wrote, @message.author)}\n> " + else + @content = +"#{ll(Setting.default_language, :text_user_wrote_in, {:value => @message.author, :link => "message##{@message.id}"})}\n> " + end @content << @message.content.to_s.strip.gsub(%r{<pre>(.*?)</pre>}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n" end |