Project

General

Profile

Defect #38217 » 38217.patch

Go MAEDA, 2023-01-28 08:30

View differences:

app/helpers/issues_helper.rb
695 695
  def issue_history_tabs
696 696
    tabs = []
697 697
    if @journals.present?
698
      journals_without_notes = @journals.select{|value| value.notes.blank?}
699
      journals_with_notes = @journals.reject{|value| value.notes.blank?}
698
      has_property_changes = @journals.any? {|value| value.details.present?}
699
      has_notes = @journals.any? {|value| value.notes.present?}
700 700
      tabs <<
701 701
        {
702 702
          :name => 'history',
......
705 705
          :partial => 'issues/tabs/history',
706 706
          :locals => {:issue => @issue, :journals => @journals}
707 707
        }
708
      if journals_with_notes.any?
708
      if has_notes
709 709
        tabs <<
710 710
          {
711 711
            :name => 'notes',
......
713 713
            :onclick => 'showIssueHistory("notes", this.href)'
714 714
          }
715 715
      end
716
      if journals_without_notes.any?
716
      if has_property_changes
717 717
        tabs <<
718 718
          {
719 719
            :name => 'properties',
test/functional/issues_controller_test.rb
3104 3104
  def test_show_display_only_all_and_notes_tabs_for_issue_with_notes_only
3105 3105
    @request.session[:user_id] = 1
3106 3106

  
3107
    get :show, :params => {:id => 6}
3107
    get :show, :params => {:id => 14}
3108 3108
    assert_response :success
3109 3109
    assert_select '#history' do
3110 3110
      assert_select 'div.tabs ul a', 2
......
3135 3135

  
3136 3136
  def test_show_display_all_notes_and_history_tabs_for_issue_with_notes_and_history_changes
3137 3137
    journal = Journal.create!(:journalized => Issue.find(6), :user_id => 1)
3138
    detail =
3139
      JournalDetail.
3140
        create!(
3141
          :journal => journal, :property => 'attr',
3142
          :prop_key => 'description',
3143
          :old_value => 'Foo', :value => 'Bar'
3144
        )
3145 3138
    @request.session[:user_id] = 1
3146 3139

  
3147 3140
    get :show, :params => {:id => 6}
(4-4/4)