Feature #31427 » 0002-Change-the-quote-content.patch
| app/controllers/journals_controller.rb | ||
|---|---|---|
|
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
|
||
| app/controllers/messages_controller.rb | ||
|---|---|---|
|
@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
|
||
| public/stylesheets/application.css | ||
|---|---|---|
|
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;}
|
||
| test/functional/journals_controller_test.rb | ||
|---|---|---|
|
: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
|
||
| test/functional/messages_controller_test.rb | ||
|---|---|---|
|
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,
|
||
| ... | ... | |
|
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
|
||