]> source.dussan.org Git - redmine.git/commitdiff
Insert a link to the source to the attribution line when quoting a note or a message...
authorGo MAEDA <maeda@farend.jp>
Sun, 2 Jun 2019 13:29:54 +0000 (13:29 +0000)
committerGo MAEDA <maeda@farend.jp>
Sun, 2 Jun 2019 13:29:54 +0000 (13:29 +0000)
Patch by Mizuki ISHIKAWA.

git-svn-id: http://svn.redmine.org/redmine/trunk@18217 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/journals_controller.rb
app/controllers/messages_controller.rb
public/stylesheets/application.css
test/functional/journals_controller_test.rb
test/functional/messages_controller_test.rb

index 2ff228998bab3bd472e0c788d7e56a22109eb373..a0a0352dde661f581a5d4287b6e4f450534eca62 100644 (file)
@@ -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
index f0830fcdb7de2ce3ed617f7f4a2f91c5128734b6..b6bcb283917288c4d88025a0b18a0aac8b4fa6b7 100644 (file)
@@ -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
 
index f08ef30b6816c5a46a31f0a7eab6e51dde7f02a8..9981efc4bbcff5e050c1fc3d39458a28d52d0e97 100644 (file)
@@ -310,7 +310,7 @@ tr.message td.created_on { white-space: nowrap; }
 tr.message td.last_message { font-size: 80%; white-space: nowrap; }
 tr.message.sticky td.subject { font-weight: bold; }
 
-body.avatars-on #replies .message {padding-left:32px;}
+body.avatars-on #replies .message.reply {padding-left: 32px;}
 #replies .reply:target h4 {background-color:#DDEEFF;}
 #replies h4 img.gravatar {margin-left:-32px;}
 
index b36ab2ddc6b778b28f953d42555fcb640e7ad20b..6b4c65514ba7de9de202c9afabb29467ce76ee78 100644 (file)
@@ -185,6 +185,7 @@ class JournalsControllerTest < Redmine::ControllerTest
       :xhr => true
     assert_response :success
     assert_equal 'text/javascript', response.content_type
+    assert_include 'Redmine Admin wrote in #note-1:', response.body
     assert_include '> A comment with a private version', response.body
   end
 
index f935780338e5d6f3a3ef762c93b8115f13e941da..64c70157bd4ad539768c12e5cfeff1d9d3df6d6a 100644 (file)
@@ -257,7 +257,22 @@ class MessagesControllerTest < Redmine::ControllerTest
     assert_nil Message.find_by_id(2)
   end
 
-  def test_quote
+  def test_quote_if_message_is_root
+    @request.session[:user_id] = 2
+    get :quote, :params => {
+        :board_id => 1,
+        :id => 1
+      },
+      :xhr => true
+    assert_response :success
+    assert_equal 'text/javascript', response.content_type
+
+    assert_include 'RE: First post', response.body
+    assert_include "Redmine Admin wrote:", response.body
+    assert_include '> This is the very first post\n> in the forum', response.body
+  end
+
+  def test_quote_if_message_is_not_root
     @request.session[:user_id] = 2
     get :quote, :params => {
         :board_id => 1,
@@ -268,6 +283,7 @@ class MessagesControllerTest < Redmine::ControllerTest
     assert_equal 'text/javascript', response.content_type
 
     assert_include 'RE: First post', response.body
+    assert_include 'John Smith wrote in message#3:', response.body
     assert_include '> An other reply', response.body
   end