Project

General

Profile

Defect #37130 » fix-37130.patch

Mizuki ISHIKAWA, 2022-05-20 04:24

View differences:

app/helpers/application_helper.rb
1251 1251
              end
1252 1252
            when 'attachment'
1253 1253
              attachments = options[:attachments] || []
1254
              attachments += obj.attachments if obj.respond_to?(:attachments)
1254
              if obj.is_a?(Journal)
1255
                attachments += obj.journalized.attachments if obj.journalized.respond_to?(:attachments)
1256
              else
1257
                attachments += obj.attachments if obj.respond_to?(:attachments)
1258
              end
1255 1259
              if attachments && attachment = Attachment.latest_attach(attachments, name)
1256 1260
                link = link_to_attachment(attachment, :only_path => only_path, :class => 'attachment')
1257 1261
              end
test/functional/issues_controller_test.rb
8386 8386
    end
8387 8387
  end
8388 8388

  
8389
  def test_show_should_be_able_to_link_to_another_journal_attachment_of_the_same_issue
8390
    @request.session[:user_id] = 1
8391
    issue = Issue.find(2)
8392
    attachment = issue.journals.first.attachments.first
8393

  
8394
    issue.init_journal(User.first, "attachment:#{attachment.filename}")
8395
    issue.save!
8396
    issue.reload
8397

  
8398
    get :show, params: { id: issue.id }
8399
    assert_select "div#history div#journal-#{issue.journals.last.id}-notes" do
8400
      assert_select "a[href='/attachments/#{attachment.id}']", :text => 'source.rb'
8401
    end
8402
  end
8403

  
8389 8404
  def test_index_should_retrieve_default_query
8390 8405
    query = IssueQuery.find(4)
8391 8406
    IssueQuery.stubs(:default).returns query
(5-5/5)