Project

General

Profile

Feature #31109 » prominent-the-assignee.patch

Yuichi HARADA, 2019-04-19 04:27

View differences:

app/views/mailer/issue_add.html.erb
1
<%= l(:text_issue_added, :id => link_to("##{@issue.id}", @issue_url), :author => h(@issue.author)).html_safe %>
1
<%= l(:text_issue_added, :id => link_to("##{@issue.id}", @issue_url), :author => h(@issue.author),
2
  :assignee => (h(' (%s: %s)' % [l(:field_assigned_to), @issue.assigned_to]) if @issue.assigned_to)).html_safe %>
2 3
<hr />
3 4
<%= render :partial => 'issue', :formats => [:html], :locals => { :issue => @issue, :user => @user, :issue_url => @issue_url } %>
app/views/mailer/issue_add.text.erb
1
<%= l(:text_issue_added, :id => "##{@issue.id}", :author => @issue.author) %>
1
<%= l(:text_issue_added, :id => "##{@issue.id}", :author => @issue.author,
2
  :assignee => (' (%s: %s)' % [l(:field_assigned_to), @issue.assigned_to] if @issue.assigned_to)) %>
2 3

  
3 4
----------------------------------------
4 5
<%= render :partial => 'issue', :formats => [:text], :locals => { :issue => @issue, :user => @user, :issue_url => @issue_url } %>
app/views/mailer/issue_edit.html.erb
1 1
<% if @journal.private_notes? %>
2 2
  (<%= l(:field_private_notes) %>)
3 3
<% end %>
4
<%= l(:text_issue_updated, :id => link_to("##{@issue.id}", @issue_url), :author => h(@journal.user)).html_safe %>
4
<%= l(:text_issue_updated, :id => link_to("##{@issue.id}", @issue_url), :author => h(@journal.user),
5
  :assignee => (h(' (%s: %s)' % [l(:field_assigned_to), @issue.assigned_to]) if @issue.assigned_to)).html_safe %>
5 6
<hr />
6 7

  
7 8
<ul class="journal details">
app/views/mailer/issue_edit.text.erb
1
<%= "(#{l(:field_private_notes)}) " if @journal.private_notes? -%><%= l(:text_issue_updated, :id => "##{@issue.id}", :author => @journal.user) %>
1
<%= "(#{l(:field_private_notes)}) " if @journal.private_notes? -%><%= l(:text_issue_updated, :id => "##{@issue.id}", :author => @journal.user,
2
  :assignee => (' (%s: %s)' % [l(:field_assigned_to), @issue.assigned_to] if @issue.assigned_to)) %>
2 3

  
3 4
<% details_to_strings(@journal_details, true).each do |string| -%>
4 5
<%= string %>
config/locales/en.yml
1142 1142
  text_comma_separated: Multiple values allowed (comma separated).
1143 1143
  text_line_separated: Multiple values allowed (one line for each value).
1144 1144
  text_issues_ref_in_commit_messages: Referencing and fixing issues in commit messages
1145
  text_issue_added: "Issue %{id} has been reported by %{author}."
1146
  text_issue_updated: "Issue %{id} has been updated by %{author}."
1145
  text_issue_added: "Issue %{id}%{assignee} has been reported by %{author}."
1146
  text_issue_updated: "Issue %{id}%{assignee} has been updated by %{author}."
1147 1147
  text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content?
1148 1148
  text_issue_category_destroy_question: "Some issues (%{count}) are assigned to this category. What do you want to do?"
1149 1149
  text_issue_category_destroy_assignments: Remove category assignments
test/unit/mailer_test.rb
546 546
    end
547 547
  end
548 548

  
549
  def test_issue_add_should_show_assignee_at_beginning_of_mailbody
550
    user_jsmith = User.find_by_login('jsmith')
551
    user_dlopper = User.find_by_login('dlopper')
552

  
553
    issue = Issue.generate!(:assigned_to_id => nil, :author_id => user_jsmith.id)
554
    ActionMailer::Base.deliveries.clear
555
    Mailer.deliver_issue_add(issue)
556
    expect = /Issue ##{issue.id} has been reported by John Smith\./
557
    assert_mail_body_match /\A#{expect}/, last_email
558
    assert_select_email do
559
      assert_select 'body', :text => expect
560
    end
561

  
562
    issue = Issue.generate!(:assigned_to_id => user_dlopper.id, :author_id => user_jsmith.id)
563
    ActionMailer::Base.deliveries.clear
564
    Mailer.deliver_issue_add(issue)
565
    expect = /Issue ##{issue.id} \(Assignee: Dave Lopper\) has been reported by John Smith\./
566
    assert_mail_body_match /\A#{expect}/, last_email
567
    assert_select_email do
568
      assert_select 'body', :text => expect
569
    end
570
  end
571

  
572
  def test_issue_edit_should_show_assignee_at_beginning_of_mailbody
573
    user_jsmith = User.find_by_login('jsmith')
574
    user_dlopper = User.find_by_login('dlopper')
575

  
576
    issue = Issue.find(1)
577
    issue.update_attributes(:author_id => user_dlopper.id)
578

  
579
    issue.update_attributes(:assigned_to_id => nil)
580
    issue.init_journal(user_jsmith)
581
    issue.reload
582
    journal = issue.journals.last
583
    ActionMailer::Base.deliveries.clear
584
    Mailer.deliver_issue_edit(journal)
585
    expect = /Issue #1 has been updated by John Smith\./
586
    assert_mail_body_match /\A#{expect}/, last_email
587
    assert_select_email do
588
      assert_select 'body', :text => expect
589
    end
590

  
591
    issue.update_attributes(:assigned_to_id => user_dlopper.id)
592
    issue.init_journal(user_jsmith)
593
    issue.reload
594
    journal = issue.journals.last
595
    ActionMailer::Base.deliveries.clear
596
    Mailer.deliver_issue_edit(journal)
597
    expect = /Issue #1 \(Assignee: Dave Lopper\) has been updated by John Smith\./
598
    assert_mail_body_match /\A#{expect}/, last_email
599
    assert_select_email do
600
      assert_select 'body', :text => expect
601
    end
602
  end
603

  
549 604
  def test_version_file_added
550 605
    attachements = [ Attachment.find_by_container_type('Version') ]
551 606
    assert Mailer.deliver_attachments_added(attachements)
(1-1/2)