Project

General

Profile

Feature #31109 » prominent-the-assignee-v2.patch

Yuichi HARADA, 2020-05-07 09:16

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), :assignee => h(@issue.assigned_to || l(:label_none)), :author => h(@issue.author)).html_safe %>
2 2
<hr />
3 3
<%= 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}", :assignee => @issue.assigned_to || l(:label_none), :author => @issue.author) %>
2 2

  
3 3
----------------------------------------
4 4
<%= 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), :assignee => h(@issue.assigned_to || l(:label_none)), :author => h(@journal.user)).html_safe %>
5 5
<hr />
6 6

  
7 7
<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}", :assignee => @issue.assigned_to || l(:label_none), :author => @journal.user) %>
2 2

  
3 3
<% details_to_strings(@journal_details, true).each do |string| -%>
4 4
<%= string %>
config/locales/en.yml
1187 1187
  text_comma_separated: Multiple values allowed (comma separated).
1188 1188
  text_line_separated: Multiple values allowed (one line for each value).
1189 1189
  text_issues_ref_in_commit_messages: Referencing and fixing issues in commit messages
1190
  text_issue_added: "Issue %{id} has been reported by %{author}."
1191
  text_issue_updated: "Issue %{id} has been updated by %{author}."
1190
  text_issue_added: "Issue %{id} (assignee: %{assignee}) has been reported by %{author}."
1191
  text_issue_updated: "Issue %{id} (assignee: %{assignee}) has been updated by %{author}."
1192 1192
  text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content?
1193 1193
  text_issue_category_destroy_question: "Some issues (%{count}) are assigned to this category. What do you want to do?"
1194 1194
  text_issue_category_destroy_assignments: Remove category assignments
test/unit/mailer_test.rb
592 592
    end
593 593
  end
594 594

  
595
  def test_issue_add_should_show_assignee_at_beginning_of_mailbody
596
    user_jsmith = User.find_by_login('jsmith')
597
    user_dlopper = User.find_by_login('dlopper')
598

  
599
    issue = Issue.generate!(:assigned_to_id => nil, :author_id => user_jsmith.id)
600
    ActionMailer::Base.deliveries.clear
601
    Mailer.deliver_issue_add(issue)
602
    expect = /Issue ##{issue.id} \(assignee: none\) has been reported by John Smith\./
603
    assert_mail_body_match /\A#{expect}/, last_email
604
    assert_select_email do
605
      assert_select 'body', :text => expect
606
    end
607

  
608
    issue = Issue.generate!(:assigned_to_id => user_dlopper.id, :author_id => user_jsmith.id)
609
    ActionMailer::Base.deliveries.clear
610
    Mailer.deliver_issue_add(issue)
611
    expect = /Issue ##{issue.id} \(assignee: Dave Lopper\) has been reported by John Smith\./
612
    assert_mail_body_match /\A#{expect}/, last_email
613
    assert_select_email do
614
      assert_select 'body', :text => expect
615
    end
616
  end
617

  
618
  def test_issue_edit_should_show_assignee_at_beginning_of_mailbody
619
    user_jsmith = User.find_by_login('jsmith')
620
    user_dlopper = User.find_by_login('dlopper')
621

  
622
    issue = Issue.find(1)
623
    issue.update_attributes(:author_id => user_dlopper.id)
624

  
625
    issue.update_attributes(:assigned_to_id => nil)
626
    issue.init_journal(user_jsmith)
627
    issue.reload
628
    journal = issue.journals.last
629
    ActionMailer::Base.deliveries.clear
630
    Mailer.deliver_issue_edit(journal)
631
    expect = /Issue #1 \(assignee: none\) has been updated by John Smith\./
632
    assert_mail_body_match /\A#{expect}/, last_email
633
    assert_select_email do
634
      assert_select 'body', :text => expect
635
    end
636

  
637
    issue.update_attributes(:assigned_to_id => user_dlopper.id)
638
    issue.init_journal(user_jsmith)
639
    issue.reload
640
    journal = issue.journals.last
641
    ActionMailer::Base.deliveries.clear
642
    Mailer.deliver_issue_edit(journal)
643
    expect = /Issue #1 \(assignee: Dave Lopper\) has been updated by John Smith\./
644
    assert_mail_body_match /\A#{expect}/, last_email
645
    assert_select_email do
646
      assert_select 'body', :text => expect
647
    end
648
  end
649

  
595 650
  def test_version_file_added
596 651
    attachements = [ Attachment.find_by_container_type('Version') ]
597 652
    assert Mailer.deliver_attachments_added(attachements)
(2-2/2)