mirror of
https://github.com/redmine/redmine.git
synced 2025-11-14 01:06:00 +01:00
Introduce reactions feature (so-called "like button") to issues, notes, news, and forums (#42630).
Patch by Katsuya HIDAKA (user:hidakatsuya). git-svn-id: https://svn.redmine.org/redmine/trunk@23755 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -3331,6 +3331,42 @@ class IssuesControllerTest < Redmine::ControllerTest
|
||||
assert_select 'span.badge.badge-private', text: 'Private'
|
||||
end
|
||||
|
||||
def test_show_should_display_reactions
|
||||
current_user = User.generate!
|
||||
|
||||
User.add_to_project(current_user, projects(:projects_001),
|
||||
Role.generate!(users_visibility: 'members_of_visible_projects', permissions: [:view_issues]))
|
||||
|
||||
@request.session[:user_id] = current_user.id
|
||||
|
||||
get :show, params: { id: 1 }
|
||||
|
||||
assert_response :success
|
||||
|
||||
assert_select 'span[data-reaction-button-id=reaction_issue_1]' do
|
||||
# The current_user can only see members who belong to projects that the current_user has access to.
|
||||
# Since the Redmine Admin user does not belong to any projects visible to the current_user,
|
||||
# the Redmine Admin user's name is not displayed in the reaction user list. Instead, "1 other" is shown.
|
||||
assert_select 'a.reaction-button[title=?]', 'Dave Lopper, John Smith, and 1 other' do
|
||||
assert_select 'span.icon-label', '3'
|
||||
end
|
||||
end
|
||||
|
||||
assert_select 'span[data-reaction-button-id=reaction_journal_1]' do
|
||||
assert_select 'a.reaction-button[title=?]', 'John Smith'
|
||||
end
|
||||
assert_select 'span[data-reaction-button-id=reaction_journal_2] a.reaction-button'
|
||||
end
|
||||
|
||||
def test_should_not_display_reactions_when_reactions_feature_is_disabled
|
||||
with_settings reactions_enabled: '0' do
|
||||
get :show, params: { id: 1 }
|
||||
|
||||
assert_response :success
|
||||
assert_select 'span[data-reaction-button-id]', false
|
||||
end
|
||||
end
|
||||
|
||||
def test_show_should_not_display_edit_attachment_icon_for_user_without_edit_issue_permission_on_tracker
|
||||
role = Role.find(2)
|
||||
role.set_permission_trackers 'edit_issues', [2, 3]
|
||||
|
||||
Reference in New Issue
Block a user