1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-01-05 23:21:31 +00:00

Refresh watchers list when watching/unwatching an issue (#4334).

git-svn-id: http://svn.redmine.org/redmine/trunk@14238 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2015-05-08 08:17:55 +00:00
parent c4374cb960
commit 5c18e6d045
3 changed files with 13 additions and 1 deletions

View File

@ -1,2 +1,3 @@
<% selector = ".#{watcher_css(watched)}" %>
$("<%= selector %>").each(function(){$(this).replaceWith("<%= escape_javascript watcher_link(watched, user) %>")});
$('#watchers').html('<%= escape_javascript(render(:partial => 'watchers/watchers', :locals => {:watched => watched.first})) %>');

View File

@ -1,4 +1,4 @@
<% if User.current.allowed_to?(:add_issue_watchers, @project) %>
<% if User.current.allowed_to?(:add_issue_watchers, watched.project) %>
<div class="contextual">
<%= link_to l(:button_add),
{:controller => 'watchers', :action => 'new', :object_type => watched.class.name.underscore, :object_id => watched},

View File

@ -227,6 +227,17 @@ class Redmine::UiTest::IssuesTest < Redmine::UiTest::Base
assert page.first('#sidebar').has_no_content?(user.name)
end
def test_watch_should_update_watchers_list
user = User.find(2)
log_user('jsmith', 'jsmith')
visit '/issues/1'
assert page.first('#sidebar').has_content?('Watchers (0)')
page.first('a.issue-1-watcher').click
assert page.first('#sidebar').has_content?('Watchers (1)')
assert page.first('#sidebar').has_content?(user.name)
end
def test_watch_issue_via_context_menu
log_user('jsmith', 'jsmith')
visit '/issues'