]> source.dussan.org Git - redmine.git/commitdiff
Fix that "Successful deletion" notice is not displayed after deleting some types...
authorGo MAEDA <maeda@farend.jp>
Sat, 4 Apr 2020 00:43:28 +0000 (00:43 +0000)
committerGo MAEDA <maeda@farend.jp>
Sat, 4 Apr 2020 00:43:28 +0000 (00:43 +0000)
Patch by Yuichi HARADA.

git-svn-id: http://svn.redmine.org/redmine/trunk@19641 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/documents_controller.rb
app/controllers/issues_controller.rb
app/controllers/news_controller.rb
app/controllers/wiki_controller.rb
test/functional/documents_controller_test.rb
test/functional/issues_controller_test.rb
test/functional/news_controller_test.rb
test/functional/wiki_controller_test.rb

index b9e2633ccb6a28d024f4ba1173a215de0c67f774..101e5443a00af5f0808b0a2ff742b75c5a2d565f 100644 (file)
@@ -83,6 +83,7 @@ class DocumentsController < ApplicationController
 
   def destroy
     @document.destroy if request.delete?
+    flash[:notice] = l(:notice_successful_delete)
     redirect_to project_documents_path(@project)
   end
 
index 0d1acc95bad3c0862b2f0e1c8e41b9c2d9aacc41..b442b355b8685529eb71abaf1483eea8f6dfe044 100644 (file)
@@ -448,7 +448,10 @@ class IssuesController < ApplicationController
       end
     end
     respond_to do |format|
-      format.html {redirect_back_or_default _project_issues_path(@project)}
+      format.html {
+        flash[:notice] = l(:notice_successful_delete)
+        redirect_back_or_default _project_issues_path(@project)
+      }
       format.api  {render_api_ok}
     end
   end
index 511f10ddbbbee97d2f2444bf174b9c3aac9396e8..a67ef88c8498b12c6e6ad7795c2d7ddd97e72387 100644 (file)
@@ -115,7 +115,10 @@ class NewsController < ApplicationController
   def destroy
     @news.destroy
     respond_to do |format|
-      format.html { redirect_to project_news_index_path(@project) }
+      format.html {
+        flash[:notice] = l(:notice_successful_delete)
+        redirect_to project_news_index_path(@project)
+      }
       format.api  { render_api_ok }
     end
   end
index 527f0b821696804297833796b0ca3652ba513347..fdb523cb6ad0cf8af82274a13ee0df5b76c8bc34 100644 (file)
@@ -284,7 +284,10 @@ class WikiController < ApplicationController
     end
     @page.destroy
     respond_to do |format|
-      format.html { redirect_to project_wiki_index_path(@project) }
+      format.html {
+        flash[:notice] = l(:notice_successful_delete)
+        redirect_to project_wiki_index_path(@project)
+      }
       format.api { render_api_ok }
     end
   end
index f4d218cc0ed1b8cf86ed53a4354f423fe4aa38b1..078b95c0febf1536220055796daca1073eb9df23 100644 (file)
@@ -240,6 +240,7 @@ class DocumentsControllerTest < Redmine::ControllerTest
         }
     end
     assert_redirected_to '/projects/ecookbook/documents'
+    assert_equal 'Successful deletion.', flash[:notice]
     assert_nil Document.find_by_id(1)
   end
 
index edcf140685a085945681bea926401c27255e7c05..21b43d7c9d9f22df09bce5fa1c8ca9b5185b8087 100644 (file)
@@ -7509,6 +7509,7 @@ class IssuesControllerTest < Redmine::ControllerTest
       delete(:destroy, :params => {:id => 2})
     end
     assert_redirected_to :action => 'index', :project_id => 'ecookbook'
+    assert_equal 'Successful deletion.', flash[:notice]
     assert_nil Issue.find_by_id(2)
   end
 
@@ -7588,6 +7589,7 @@ class IssuesControllerTest < Redmine::ControllerTest
       end
     end
     assert_redirected_to :action => 'index', :project_id => 'ecookbook'
+    assert_equal 'Successful deletion.', flash[:notice]
     assert !(Issue.find_by_id(1) || Issue.find_by_id(3))
     assert_nil TimeEntry.find_by_id([1, 2])
   end
@@ -7609,6 +7611,7 @@ class IssuesControllerTest < Redmine::ControllerTest
     end
     end
     assert_redirected_to :action => 'index', :project_id => 'ecookbook'
+    assert_equal 'Successful deletion.', flash[:notice]
     assert !(Issue.find_by_id(1) || Issue.find_by_id(3))
     assert_nil TimeEntry.find(1).issue_id
     assert_nil TimeEntry.find(2).issue_id
@@ -7630,6 +7633,7 @@ class IssuesControllerTest < Redmine::ControllerTest
       end
     end
     assert_redirected_to :action => 'index', :project_id => 'ecookbook'
+    assert_equal 'Successful deletion.', flash[:notice]
     assert !(Issue.find_by_id(1) || Issue.find_by_id(3))
     assert_equal 2, TimeEntry.find(1).issue_id
     assert_equal 2, TimeEntry.find(2).issue_id
@@ -7654,6 +7658,7 @@ class IssuesControllerTest < Redmine::ControllerTest
           }
         )
         assert_response 302
+        assert_equal 'Successful deletion.', flash[:notice]
       end
     end
     assert_equal 3, target.time_entries.count
@@ -7730,6 +7735,7 @@ class IssuesControllerTest < Redmine::ControllerTest
       )
     end
     assert_redirected_to :controller => 'issues', :action => 'index'
+    assert_equal 'Successful deletion.', flash[:notice]
     assert !(Issue.find_by_id(1) || Issue.find_by_id(2) || Issue.find_by_id(6))
   end
 
@@ -7750,6 +7756,7 @@ class IssuesControllerTest < Redmine::ControllerTest
       )
     end
     assert_response 302
+    assert_equal 'Successful deletion.', flash[:notice]
   end
 
   def test_destroy_invalid_should_respond_with_404
@@ -7770,6 +7777,7 @@ class IssuesControllerTest < Redmine::ControllerTest
       delete(:destroy, :params => {:id => issue.id})
     end
     assert_response 302
+    assert_equal 'Successful deletion.', flash[:notice]
   end
 
   def test_destroy_without_permission_on_tracker_should_be_denied
index c870272efb0f4dd09085a4c2a649bd706f4c4576..76517e1a1dd29775073831605d93b65e8e4ababc 100644 (file)
@@ -243,6 +243,7 @@ class NewsControllerTest < Redmine::ControllerTest
     @request.session[:user_id] = 2
     delete(:destroy, :params => {:id => 1})
     assert_redirected_to '/projects/ecookbook/news'
+    assert_equal 'Successful deletion.', flash[:notice]
     assert_nil News.find_by_id(1)
   end
 end
index d5dfe12478d7e55764691d93091a506f4a2722fd..b75bdaae8c5fb770cbbf1fb3e44e849477fb35df 100644 (file)
@@ -914,6 +914,7 @@ class WikiControllerTest < Redmine::ControllerTest
     @request.session[:user_id] = 2
     delete :destroy, :params => {:project_id => 1, :id => 'Child_2'}
     assert_redirected_to :action => 'index', :project_id => 'ecookbook'
+    assert_equal 'Successful deletion.', flash[:notice]
   end
 
   def test_destroy_parent_should_ask_confirmation
@@ -935,6 +936,7 @@ class WikiControllerTest < Redmine::ControllerTest
       delete :destroy, :params => {:project_id => 1, :id => 'Another_page', :todo => 'nullify'}
     end
     assert_redirected_to :action => 'index', :project_id => 'ecookbook'
+    assert_equal 'Successful deletion.', flash[:notice]
     assert_nil WikiPage.find_by_id(2)
   end
 
@@ -944,6 +946,7 @@ class WikiControllerTest < Redmine::ControllerTest
       delete :destroy, :params => {:project_id => 1, :id => 'Another_page', :todo => 'destroy'}
     end
     assert_redirected_to :action => 'index', :project_id => 'ecookbook'
+    assert_equal 'Successful deletion.', flash[:notice]
     assert_nil WikiPage.find_by_id(2)
     assert_nil WikiPage.find_by_id(5)
   end
@@ -954,6 +957,7 @@ class WikiControllerTest < Redmine::ControllerTest
       delete :destroy, :params => {:project_id => 1, :id => 'Another_page', :todo => 'reassign', :reassign_to_id => 1}
     end
     assert_redirected_to :action => 'index', :project_id => 'ecookbook'
+    assert_equal 'Successful deletion.', flash[:notice]
     assert_nil WikiPage.find_by_id(2)
     assert_equal WikiPage.find(1), WikiPage.find_by_id(5).parent
   end