0003-Show-an-warning-message-for-watchers-who-cannot-view.patch

Marius BALTEANU, 2020-04-20 14:48

Download (3.51 KB)

View differences:

app/helpers/watchers_helper.rb
51 51
      s = ''.html_safe
52 52
      s << avatar(user, :size => "16").to_s
53 53
      s << link_to_user(user, :class => 'user')
54
      if object.respond_to?(:visible?) && user.is_a?(User) && !object.visible?(user)
55
        s << content_tag('span', l(:notice_invalid_watcher), class: 'icon-only icon-warning', title: l(:notice_invalid_watcher))
56
      end
54 57
      if remove_allowed
55 58
        url = {:controller => 'watchers',
56 59
               :action => 'destroy',
config/locales/en.yml
194 194
  notice_issue_not_closable_by_open_tasks: "This issue cannot be closed because it has at least one open subtask."
195 195
  notice_issue_not_closable_by_blocking_issue: "This issue cannot be closed because it is blocked by at least one open issue."
196 196
  notice_issue_not_reopenable_by_closed_parent_issue: "This issue cannot be reopened because its parent issue is closed."
197
  notice_invalid_watcher: "Invalid watcher: User will not receive any notifications because it does not have access to view this object."
197 198

  
198 199
  error_can_t_load_default_data: "Default configuration could not be loaded: %{value}"
199 200
  error_scm_not_found: "The entry or revision was not found in the repository."
public/stylesheets/application.css
104 104
#sidebar div.wiki ul li {list-style-type:inherit;}
105 105
#sidebar a.icon-only {opacity: 0.4; margin-left: 5px;}
106 106
#sidebar a.icon-only:hover {opacity: 1;}
107
#sidebar span.icon-warning {margin-left: 5px;}
107 108
#sidebar li input[type=checkbox] {height: 20px;}
108 109

  
109 110
#content { flex-grow: 1; background-color: #fff; margin: 0px; padding: 6px 10px 10px 10px; overflow-x: auto;}
test/functional/issues_controller_test.rb
2557 2557
    end
2558 2558
  end
2559 2559

  
2560
  def test_show_should_mark_invalid_watchers
2561
    @request.session[:user_id] = 2
2562
    issue = Issue.find(4)
2563
    issue.add_watcher User.find(4)
2564

  
2565
    get :show, :params => {:id => issue.id}
2566

  
2567
    assert_response :success
2568
    assert_select 'div#watchers ul' do
2569
      assert_select 'li.user-4' do
2570
        assert_select 'span.icon-warning[title=?]', l(:notice_invalid_watcher), text: l(:notice_invalid_watcher)
2571
      end
2572
    end
2573
  end
2574

  
2560 2575
  def test_show_with_thumbnails_enabled_should_display_thumbnails
2561 2576
    skip unless convert_installed?
2562 2577
    @request.session[:user_id] = 2
2563
-