This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new adb7fddc Add an undelete button
adb7fddc is described below

commit adb7fddc264018acb75aff78439a2836f9b3a28c
Author: Sebb <[email protected]>
AuthorDate: Thu Aug 1 15:10:13 2024 +0100

    Add an undelete button
---
 www/secretary/workbench/views/parts.js.rb | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/www/secretary/workbench/views/parts.js.rb 
b/www/secretary/workbench/views/parts.js.rb
index 8f1c86c2..f9bfe50e 100644
--- a/www/secretary/workbench/views/parts.js.rb
+++ b/www/secretary/workbench/views/parts.js.rb
@@ -50,6 +50,10 @@ class Parts < Vue
       }
     }
 
+    _ul do
+      _li "undelete this email", onMousedown: self.undelete_message
+    end
+
     _ul do
       _li "\u2716 delete this email", onMousedown: self.delete_message
     end
@@ -559,6 +563,18 @@ class Parts < Vue
     }
   end
 
+  # undelete a message
+  def undelete_message(event)
+    @busy = true
+    pathname = window.parent.location.pathname
+    HTTP.patch(pathname, status: nil).then {
+      window.parent.location.href = '../..'
+    }.catch {|error|
+      alert error
+      @busy = false
+    }
+  end
+
   # delete an attachment
   def delete_attachment(event)
     data = {

Reply via email to