diff options
-rw-r--r-- | app/views/watchers/_set_watcher.js.erb | 1 | ||||
-rw-r--r-- | app/views/watchers/_watchers.html.erb | 2 | ||||
-rw-r--r-- | test/ui/issues_test_ui.rb | 11 |
3 files changed, 13 insertions, 1 deletions
diff --git a/app/views/watchers/_set_watcher.js.erb b/app/views/watchers/_set_watcher.js.erb index e5cdc4f3e..4090ef6ce 100644 --- a/app/views/watchers/_set_watcher.js.erb +++ b/app/views/watchers/_set_watcher.js.erb @@ -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})) %>'); diff --git a/app/views/watchers/_watchers.html.erb b/app/views/watchers/_watchers.html.erb index 697d0bd8e..f3cb895ae 100644 --- a/app/views/watchers/_watchers.html.erb +++ b/app/views/watchers/_watchers.html.erb @@ -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}, diff --git a/test/ui/issues_test_ui.rb b/test/ui/issues_test_ui.rb index dec6565d9..cbca9f84d 100644 --- a/test/ui/issues_test_ui.rb +++ b/test/ui/issues_test_ui.rb @@ -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' |