1
0
mirror of https://github.com/meineerde/redmine.git synced 2025-12-26 10:21:14 +00:00

Show a warning message for watchers who cannot view the object (#33329).

Patch by Marius BALTEANU.


git-svn-id: http://svn.redmine.org/redmine/trunk@20725 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA 2021-01-24 05:38:22 +00:00
parent 0f4228d4e6
commit 091dd36acc
4 changed files with 20 additions and 0 deletions

View File

@ -52,6 +52,9 @@ module WatchersHelper
s = ''.html_safe
s << avatar(user, :size => "16").to_s
s << link_to_user(user, :class => 'user')
if object.respond_to?(:visible?) && user.is_a?(User) && !object.visible?(user)
s << content_tag('span', l(:notice_invalid_watcher), class: 'icon-only icon-warning', title: l(:notice_invalid_watcher))
end
if remove_allowed
url = {:controller => 'watchers',
:action => 'destroy',

View File

@ -193,6 +193,7 @@ en:
notice_issue_not_closable_by_open_tasks: "This issue cannot be closed because it has at least one open subtask."
notice_issue_not_closable_by_blocking_issue: "This issue cannot be closed because it is blocked by at least one open issue."
notice_issue_not_reopenable_by_closed_parent_issue: "This issue cannot be reopened because its parent issue is closed."
notice_invalid_watcher: "Invalid watcher: User will not receive any notifications because it does not have access to view this object."
error_can_t_load_default_data: "Default configuration could not be loaded: %{value}"
error_scm_not_found: "The entry or revision was not found in the repository."

View File

@ -104,6 +104,7 @@ div#wrapper, div#wrapper2, div#wrapper3 { min-height: inherit; }
#sidebar div.wiki ul li {list-style-type:inherit;}
#sidebar a.icon-only {opacity: 0.4; margin-left: 5px;}
#sidebar a.icon-only:hover {opacity: 1;}
#sidebar span.icon-warning {margin-left: 5px;}
#sidebar li input[type=checkbox] {height: 20px;}
#content { flex-grow: 1; background-color: #fff; margin: 0px; padding: 10px 16px 10px 16px; overflow-x: auto;}

View File

@ -2657,6 +2657,21 @@ class IssuesControllerTest < Redmine::ControllerTest
end
end
def test_show_should_mark_invalid_watchers
@request.session[:user_id] = 2
issue = Issue.find(4)
issue.add_watcher User.find(4)
get :show, :params => {:id => issue.id}
assert_response :success
assert_select 'div#watchers ul' do
assert_select 'li.user-4' do
assert_select 'span.icon-warning[title=?]', l(:notice_invalid_watcher), text: l(:notice_invalid_watcher)
end
end
end
def test_show_with_thumbnails_enabled_should_display_thumbnails
skip unless convert_installed?
@request.session[:user_id] = 2