summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2013-02-20 20:43:28 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2013-02-20 20:43:28 +0000
commitaca31973c28110047efd30537d5266b4c8987080 (patch)
treea107a050b2678f9dec581658c21807806406f50f
parentf8c649320f849dec288407a771d446108dc40931 (diff)
downloadredmine-aca31973c28110047efd30537d5266b4c8987080.tar.gz
redmine-aca31973c28110047efd30537d5266b4c8987080.zip
Fixed that delete watcher link was broken by r11290 (#13231).
Deleting a watcher now use DELETE /watchers instead of POST /watchers/destroy. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11443 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/helpers/watchers_helper.rb6
-rw-r--r--config/routes.rb2
-rw-r--r--test/functional/watchers_controller_test.rb2
-rw-r--r--test/integration/routing/watchers_test.rb2
-rw-r--r--test/ui/issues_test.rb13
5 files changed, 19 insertions, 6 deletions
diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb
index 4aab507bd..d7384e7a1 100644
--- a/app/helpers/watchers_helper.rb
+++ b/app/helpers/watchers_helper.rb
@@ -63,11 +63,11 @@ module WatchersHelper
:user_id => user}
s << ' '
s << link_to(image_tag('delete.png'), url,
- :remote => true, :method => 'post', :style => "vertical-align: middle", :class => "delete")
+ :remote => true, :method => 'delete', :style => "vertical-align: middle", :class => "delete")
end
- content << content_tag('li', s)
+ content << content_tag('li', s, :class => "user-#{user.id}")
end
- content.present? ? content_tag('ul', content) : content
+ content.present? ? content_tag('ul', content, :class => 'watchers') : content
end
def watchers_checkboxes(object, users, checked=nil)
diff --git a/config/routes.rb b/config/routes.rb
index b89973e55..7d0ff8573 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -82,7 +82,7 @@ RedmineApp::Application.routes.draw do
get 'watchers/new', :to => 'watchers#new'
post 'watchers', :to => 'watchers#create'
post 'watchers/append', :to => 'watchers#append'
- post 'watchers/destroy', :to => 'watchers#destroy'
+ delete 'watchers', :to => 'watchers#destroy'
get 'watchers/autocomplete_for_user', :to => 'watchers#autocomplete_for_user'
# Specific routes for issue watchers API
post 'issues/:object_id/watchers', :to => 'watchers#create', :object_type => 'issue'
diff --git a/test/functional/watchers_controller_test.rb b/test/functional/watchers_controller_test.rb
index 7c80b0f4b..bc8b58b0c 100644
--- a/test/functional/watchers_controller_test.rb
+++ b/test/functional/watchers_controller_test.rb
@@ -186,7 +186,7 @@ class WatchersControllerTest < ActionController::TestCase
def test_remove_watcher
@request.session[:user_id] = 2
assert_difference('Watcher.count', -1) do
- xhr :post, :destroy, :object_type => 'issue', :object_id => '2', :user_id => '3'
+ xhr :delete, :destroy, :object_type => 'issue', :object_id => '2', :user_id => '3'
assert_response :success
assert_match /watchers/, response.body
end
diff --git a/test/integration/routing/watchers_test.rb b/test/integration/routing/watchers_test.rb
index 39ef5a786..eb6a62163 100644
--- a/test/integration/routing/watchers_test.rb
+++ b/test/integration/routing/watchers_test.rb
@@ -32,7 +32,7 @@ class RoutingWatchersTest < ActionController::IntegrationTest
{ :controller => 'watchers', :action => 'create' }
)
assert_routing(
- { :method => 'post', :path => "/watchers/destroy" },
+ { :method => 'delete', :path => "/watchers" },
{ :controller => 'watchers', :action => 'destroy' }
)
assert_routing(
diff --git a/test/ui/issues_test.rb b/test/ui/issues_test.rb
index 3a628c9b6..66a6197bb 100644
--- a/test/ui/issues_test.rb
+++ b/test/ui/issues_test.rb
@@ -172,6 +172,19 @@ class Redmine::UiTest::IssuesTest < Redmine::UiTest::Base
assert_equal 'CF value', issue.custom_field_value(field)
end
+ def test_remove_issue_watcher_from_sidebar
+ user = User.find(3)
+ Watcher.create!(:watchable => Issue.find(1), :user => user)
+
+ log_user('jsmith', 'jsmith')
+ visit '/issues/1'
+ assert page.first('#sidebar').has_content?(user.name)
+ assert_difference 'Watcher.count', -1 do
+ page.first('ul.watchers .user-3 a.delete').click
+ end
+ assert page.first('#sidebar').has_no_content?(user.name)
+ end
+
def test_watch_issue_via_context_menu
log_user('jsmith', 'jsmith')
visit '/issues'