Project

General

Profile

Defect #38217 » 38217.patch

Go MAEDA, 2023-01-28 08:30

View differences:

app/helpers/issues_helper.rb
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_property_changes = @journals.any? {|value| value.details.present?}
has_notes = @journals.any? {|value| value.notes.present?}
tabs <<
{
:name => 'history',
......
:partial => 'issues/tabs/history',
:locals => {:issue => @issue, :journals => @journals}
}
if journals_with_notes.any?
if has_notes
tabs <<
{
:name => 'notes',
......
:onclick => 'showIssueHistory("notes", this.href)'
}
end
if journals_without_notes.any?
if has_property_changes
tabs <<
{
:name => 'properties',
test/functional/issues_controller_test.rb
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
......
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}
(4-4/4)