mirror of
https://github.com/redmine/redmine.git
synced 2025-11-14 01:06:00 +01:00
Allow reactions on journals with property changes only (#42630).
Patch by Katsuya HIDAKA (user:hidakatsuya). git-svn-id: https://svn.redmine.org/redmine/trunk@23781 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -426,7 +426,7 @@ function showIssueHistory(journal, url) {
|
|||||||
tab_content.find('.journal').show();
|
tab_content.find('.journal').show();
|
||||||
tab_content.find('.journal:not(.has-notes)').hide();
|
tab_content.find('.journal:not(.has-notes)').hide();
|
||||||
tab_content.find('.journal .wiki').show();
|
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
|
// always show thumbnails in notes tab
|
||||||
var thumbnails = tab_content.find('.journal .thumbnails');
|
var thumbnails = tab_content.find('.journal .thumbnails');
|
||||||
@@ -439,13 +439,15 @@ function showIssueHistory(journal, url) {
|
|||||||
tab_content.find('.journal:not(.has-details)').hide();
|
tab_content.find('.journal:not(.has-details)').hide();
|
||||||
tab_content.find('.journal .wiki').hide();
|
tab_content.find('.journal .wiki').hide();
|
||||||
tab_content.find('.journal .thumbnails').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;
|
break;
|
||||||
default:
|
default:
|
||||||
tab_content.find('.journal').show();
|
tab_content.find('.journal').show();
|
||||||
tab_content.find('.journal .wiki').show();
|
tab_content.find('.journal .wiki').show();
|
||||||
tab_content.find('.journal .thumbnails').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;
|
return false;
|
||||||
|
|||||||
@@ -41,9 +41,9 @@ module JournalsHelper
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
if journal.notes.present?
|
links << reaction_button(journal)
|
||||||
links << reaction_button(journal)
|
|
||||||
|
|
||||||
|
if journal.notes.present?
|
||||||
if options[:reply_links]
|
if options[:reply_links]
|
||||||
url = quoted_issue_path(issue, :journal_id => journal, :journal_indice => indice)
|
url = quoted_issue_path(issue, :journal_id => journal, :journal_indice => indice)
|
||||||
links << quote_reply(url, "#journal-#{journal.id}-notes", icon_only: true)
|
links << quote_reply(url, "#journal-#{journal.id}-notes", icon_only: true)
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ module ReactionsHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
def reaction_button_wrapper(object, &)
|
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
|
end
|
||||||
|
|
||||||
def build_reaction_tooltip(visible_user_names, count)
|
def build_reaction_tooltip(visible_user_names, count)
|
||||||
|
|||||||
@@ -51,6 +51,23 @@ class JournalsHelperTest < Redmine::HelperTest
|
|||||||
assert_select_in journal_actions, 'a[title=?][class="icon-only icon-edit"]', 'Edit'
|
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-del"]'
|
||||||
assert_select_in journal_actions, 'div[class="drdn-items"] a[class="icon icon-copy-link"]'
|
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
|
end
|
||||||
|
|
||||||
def test_journal_thumbnail_attachments_should_be_in_the_same_order_as_the_journal_details
|
def test_journal_thumbnail_attachments_should_be_in_the_same_order_as_the_journal_details
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ class ReactionsHelperTest < ActionView::TestCase
|
|||||||
end
|
end
|
||||||
tooltip = 'Dave Lopper, John Smith, and Redmine Admin'
|
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)
|
href = reaction_path(issue.reaction_detail.user_reaction, object_type: 'Issue', object_id: 1)
|
||||||
|
|
||||||
assert_select 'a.icon.reaction-button.reacted[href=?]', href do
|
assert_select 'a.icon.reaction-button.reacted[href=?]', href do
|
||||||
@@ -194,7 +194,7 @@ class ReactionsHelperTest < ActionView::TestCase
|
|||||||
end
|
end
|
||||||
tooltip = 'Dave Lopper, John Smith, and Redmine Admin'
|
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)
|
href = reactions_path(object_type: 'Issue', object_id: 1)
|
||||||
|
|
||||||
assert_select 'a.icon.reaction-button[href=?]', href do
|
assert_select 'a.icon.reaction-button[href=?]', href do
|
||||||
|
|||||||
@@ -113,6 +113,47 @@ class ReactionsSystemTest < ApplicationSystemTestCase
|
|||||||
end
|
end
|
||||||
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
|
private
|
||||||
|
|
||||||
def assert_reaction_add_and_remove(reaction_button, expected_subject)
|
def assert_reaction_add_and_remove(reaction_button, expected_subject)
|
||||||
|
|||||||
Reference in New Issue
Block a user