Project

General

Profile

Feature #31427 » 0002-Change-the-quote-content.patch

Mizuki ISHIKAWA, 2019-05-23 04:37

View differences:

app/controllers/journals_controller.rb
66 66
    if @journal
67 67
      user = @journal.user
68 68
      text = @journal.notes
69
      indice = @journal.issue.visible_journals_with_index.find{|j| j.id == @journal.id}.indice
70
      @content = +"#{ll(Setting.default_language, :text_user_wrote_in, {:value => user, :link => "#note-#{indice}"})}\n> "
69 71
    else
70 72
      user = @issue.author
71 73
      text = @issue.description
74
      @content = +"#{ll(Setting.default_language, :text_user_wrote, user)}\n> "
72 75
    end
73 76
    # Replaces pre blocks with [...]
74 77
    text = text.to_s.strip.gsub(%r{<pre>(.*?)</pre>}m, '[...]')
75
    @content = +"#{ll(Setting.default_language, :text_user_wrote, user)}\n> "
76 78
    @content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
77 79
  rescue ActiveRecord::RecordNotFound
78 80
    render_404
app/controllers/messages_controller.rb
117 117
    @subject = @message.subject
118 118
    @subject = "RE: #{@subject}" unless @subject.starts_with?('RE:')
119 119

  
120
    @content = +"#{ll(Setting.default_language, :text_user_wrote, @message.author)}\n> "
120
    if @message.root == @message
121
      @content = +"#{ll(Setting.default_language, :text_user_wrote, @message.author)}\n> "
122
    else
123
      @content = +"#{ll(Setting.default_language, :text_user_wrote_in, {:value => @message.author, :link => "message##{@message.id}"})}\n> "
124
    end
121 125
    @content << @message.content.to_s.strip.gsub(%r{<pre>(.*?)</pre>}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
122 126
  end
123 127

  
public/stylesheets/application.css
311 311
tr.message td.last_message { font-size: 80%; white-space: nowrap; }
312 312
tr.message.sticky td.subject { font-weight: bold; }
313 313

  
314
body.avatars-on #replies .message {padding-left:32px;}
314
body.avatars-on #replies .message.reply {padding-left: 32px;}
315 315
#replies .reply:target h4 {background-color:#DDEEFF;}
316 316
#replies h4 img.gravatar {margin-left:-32px;}
317 317

  
test/functional/journals_controller_test.rb
185 185
      :xhr => true
186 186
    assert_response :success
187 187
    assert_equal 'text/javascript', response.content_type
188
    assert_include 'Redmine Admin wrote in #note-1:', response.body
188 189
    assert_include '> A comment with a private version', response.body
189 190
  end
190 191

  
test/functional/messages_controller_test.rb
257 257
    assert_nil Message.find_by_id(2)
258 258
  end
259 259

  
260
  def test_quote
260
  def test_quote_if_message_is_root
261
    @request.session[:user_id] = 2
262
    get :quote, :params => {
263
        :board_id => 1,
264
        :id => 1
265
      },
266
      :xhr => true
267
    assert_response :success
268
    assert_equal 'text/javascript', response.content_type
269

  
270
    assert_include 'RE: First post', response.body
271
    assert_include "Redmine Admin wrote:", response.body
272
    assert_include '> This is the very first post\n> in the forum', response.body
273
  end
274

  
275
  def test_quote_if_message_is_not_root
261 276
    @request.session[:user_id] = 2
262 277
    get :quote, :params => {
263 278
        :board_id => 1,
......
268 283
    assert_equal 'text/javascript', response.content_type
269 284

  
270 285
    assert_include 'RE: First post', response.body
286
    assert_include 'John Smith wrote in message#3:', response.body
271 287
    assert_include '> An other reply', response.body
272 288
  end
273 289

  
(1-1/5)