Defect #33116

Successful deletion notice is not displayed after deleting some types of content

Added by Go MAEDA 3 months ago. Updated about 1 month ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

Category:UI
Target version:4.2.0
Resolution:Fixed Affected version:

Description

"Successful deletion" flash message is not displayed after deleting some types of objects such as issues, documents, and wiki pages. However, you will see the message after deleting time entries or messages.

I think the message should be displayed when deleting any type of content for consistency and usability.

Type of object Notice after deletion
Attachment No
Document No
Issue No
Message "Successful deletion."
News No
TimeEntry "Successful deletion."
WikiPage No

33116.patch Magnifier (7.58 KB) Yuichi HARADA, 2020-03-30 08:20

Associated revisions

Revision 19641
Added by Go MAEDA about 1 month ago

Fix that "Successful deletion" notice is not displayed after deleting some types of content (#33116).

Patch by Yuichi HARADA.

History

#1 Updated by Yuichi HARADA 2 months ago

The following patch will display a "Successful deletion" flash message after deleting issues, documents, news, and wiki pages.
I think that you don't need to display a flash message because the attachments disappear dynamically on the screen when you delete them.

diff --git a/app/controllers/documents_controller.rb b/app/controllers/documents_controller.rb
index b9e2633cc..101e5443a 100644
--- a/app/controllers/documents_controller.rb
+++ b/app/controllers/documents_controller.rb
@@ -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

diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb
index 0d1acc95b..b442b355b 100644
--- a/app/controllers/issues_controller.rb
+++ b/app/controllers/issues_controller.rb
@@ -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
diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb
index 511f10ddb..a67ef88c8 100644
--- a/app/controllers/news_controller.rb
+++ b/app/controllers/news_controller.rb
@@ -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
diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb
index 527f0b821..fdb523cb6 100644
--- a/app/controllers/wiki_controller.rb
+++ b/app/controllers/wiki_controller.rb
@@ -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

#2 Updated by Go MAEDA 2 months ago

  • Target version set to 4.2.0

Setting the target version to 4.2.0.

#3 Updated by Go MAEDA about 1 month ago

  • Status changed from New to Closed
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the patch. Thank you.

Also available in: Atom PDF