Project

General

Profile

Feature #42630 » Allow-reactions-to-journals-with-only-property-changes.patch

Katsuya HIDAKA, 2025-05-16 12:16

View differences:

app/assets/javascripts/application-legacy.js
tab_content.find('.journal').show();
tab_content.find('.journal:not(.has-notes)').hide();
tab_content.find('.journal .wiki').show();
tab_content.find('.journal .contextual .journal-actions').show();
tab_content.find('.journal .contextual .journal-actions > *').show();
// always show thumbnails in notes tab
var thumbnails = tab_content.find('.journal .thumbnails');
......
tab_content.find('.journal:not(.has-details)').hide();
tab_content.find('.journal .wiki').hide();
tab_content.find('.journal .thumbnails').hide();
tab_content.find('.journal .contextual .journal-actions').hide();
tab_content.find('.journal .contextual .journal-actions > *').hide();
// Show reaction button in properties tab
tab_content.find('.journal .contextual .journal-actions .reaction-button-wrapper').show();
break;
default:
tab_content.find('.journal').show();
tab_content.find('.journal .wiki').show();
tab_content.find('.journal .thumbnails').show();
tab_content.find('.journal .contextual .journal-actions').show();
tab_content.find('.journal .contextual .journal-actions > *').show();
}
return false;
app/helpers/journals_helper.rb
)
end
if journal.notes.present?
links << reaction_button(journal)
links << reaction_button(journal)
if journal.notes.present?
if options[:reply_links]
url = quoted_issue_path(issue, :journal_id => journal, :journal_indice => indice)
links << quote_reply(url, "#journal-#{journal.id}-notes", icon_only: true)
app/helpers/reactions_helper.rb
end
def reaction_button_wrapper(object, &)
tag.span(data: { 'reaction-button-id': reaction_id_for(object) }, &)
tag.span(class: 'reaction-button-wrapper', data: { 'reaction-button-id': reaction_id_for(object) }, &)
end
def build_reaction_tooltip(visible_user_names, count)
test/helpers/journals_helper_test.rb
assert_select_in journal_actions, 'a[title=?][class="icon-only icon-edit"]', 'Edit'
assert_select_in journal_actions, 'div[class="drdn-items"] a[class="icon icon-del"]'
assert_select_in journal_actions, 'div[class="drdn-items"] a[class="icon icon-copy-link"]'
assert_select_in journal_actions, 'span.reaction-button-wrapper'
end
def test_render_journal_actions_with_journal_without_notes
User.current = User.find(1)
issue = Issue.find(1)
issue.journals.first.update!(notes: '')
journals = issue.visible_journals_with_index
journal_actions = render_journal_actions(issue, journals.first, reply_links: true)
assert_select_in journal_actions, 'span.reaction-button-wrapper'
assert_select_in journal_actions, 'span.drdn'
assert_select_in journal_actions, 'a[class="icon-comment"]', false
assert_select_in journal_actions, 'a[class="icon-edit"]', false
end
def test_journal_thumbnail_attachments_should_be_in_the_same_order_as_the_journal_details
test/helpers/reactions_helper_test.rb
end
tooltip = 'Dave Lopper, John Smith, and Redmine Admin'
assert_select_in result, 'span[data-reaction-button-id=?]', 'reaction_issue_1' do
assert_select_in result, 'span.reaction-button-wrapper[data-reaction-button-id=?]', 'reaction_issue_1' do
href = reaction_path(issue.reaction_detail.user_reaction, object_type: 'Issue', object_id: 1)
assert_select 'a.icon.reaction-button.reacted[href=?]', href do
......
end
tooltip = 'Dave Lopper, John Smith, and Redmine Admin'
assert_select_in result, 'span[data-reaction-button-id=?]', 'reaction_issue_1' do
assert_select_in result, 'span.reaction-button-wrapper[data-reaction-button-id=?]', 'reaction_issue_1' do
href = reactions_path(object_type: 'Issue', object_id: 1)
assert_select 'a.icon.reaction-button[href=?]', href do
test/system/reactions_test.rb
end
end
def test_reaction_button_is_visible_on_property_changes_tab
# Create a journal with no notes
journal_without_notes = Journal.generate!(journalized: issues(:issues_001), notes: '', details: [JournalDetail.new])
log_user('jsmith', 'jsmith')
visit '/issues/1?tab=properties'
# Scroll to the history content
click_link '#1'
assert_selector '#tab-properties.selected'
within('#change-1') do
assert_selector 'a.reaction-button'
assert_no_selector 'a.icon-comment'
assert_no_selector 'span.drdn'
end
within("#change-#{journal_without_notes.id}") do
assert_selector 'a.reaction-button'
assert_no_selector '.drdn'
end
click_link 'History'
within('#change-1') do
assert_selector 'a.reaction-button'
assert_selector 'a.icon-comment'
assert_selector 'span.drdn'
end
within("#change-#{journal_without_notes.id}") do
assert_selector 'a.reaction-button'
assert_selector 'span.drdn'
assert_no_selector 'a.icon-comment'
end
end
private
def assert_reaction_add_and_remove(reaction_button, expected_subject)
(24-24/30)