]> source.dussan.org Git - redmine.git/commitdiff
Merged r22085 from trunk to 5.0-stable (#38217).
authorGo MAEDA <maeda@farend.jp>
Fri, 3 Feb 2023 00:58:04 +0000 (00:58 +0000)
committerGo MAEDA <maeda@farend.jp>
Fri, 3 Feb 2023 00:58:04 +0000 (00:58 +0000)
git-svn-id: https://svn.redmine.org/redmine/branches/5.0-stable@22089 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/issues_helper.rb
test/functional/issues_controller_test.rb

index ca1b2760f153b8d5260fe8542dc9c8f2c95b6faa..541a6f5afbe82c1fd8d9cb6212d57c3de39d7c3c 100644 (file)
@@ -693,8 +693,8 @@ module IssuesHelper
   def issue_history_tabs
     tabs = []
     if @journals.present?
-      journals_without_notes = @journals.select{|value| value.notes.blank?}
-      journals_with_notes = @journals.reject{|value| value.notes.blank?}
+      has_details = @journals.any? {|value| value.details.present?}
+      has_notes = @journals.any? {|value| value.notes.present?}
       tabs <<
         {
           :name => 'history',
@@ -703,7 +703,7 @@ module IssuesHelper
           :partial => 'issues/tabs/history',
           :locals => {:issue => @issue, :journals => @journals}
         }
-      if journals_with_notes.any?
+      if has_notes
         tabs <<
           {
             :name => 'notes',
@@ -711,7 +711,7 @@ module IssuesHelper
             :onclick => 'showIssueHistory("notes", this.href)'
           }
       end
-      if journals_without_notes.any?
+      if has_details
         tabs <<
           {
             :name => 'properties',
index 732c01956b3410a2a502e76e4c30cc3d5427092d..8d08e4b767f2883ca60e9d003c3895cf18277f42 100644 (file)
@@ -3068,7 +3068,7 @@ class IssuesControllerTest < Redmine::ControllerTest
   def test_show_display_only_all_and_notes_tabs_for_issue_with_notes_only
     @request.session[:user_id] = 1
 
-    get :show, :params => {:id => 6}
+    get :show, :params => {:id => 14}
     assert_response :success
     assert_select '#history' do
       assert_select 'div.tabs ul a', 2
@@ -3099,13 +3099,6 @@ class IssuesControllerTest < Redmine::ControllerTest
 
   def test_show_display_all_notes_and_history_tabs_for_issue_with_notes_and_history_changes
     journal = Journal.create!(:journalized => Issue.find(6), :user_id => 1)
-    detail =
-      JournalDetail.
-        create!(
-          :journal => journal, :property => 'attr',
-          :prop_key => 'description',
-          :old_value => 'Foo', :value => 'Bar'
-        )
     @request.session[:user_id] = 1
 
     get :show, :params => {:id => 6}