You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by hu...@apache.org on 2021/09/27 18:50:10 UTC
[incubator-ponymail-foal] 05/05: regen JS
This is an automated email from the ASF dual-hosted git repository.
humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
commit b9f0817ea132832a8bee4e9ae0694078810a3afb
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Mon Sep 27 13:49:53 2021 -0500
regen JS
---
webui/js/ponymail.js | 67 ++++++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 62 insertions(+), 5 deletions(-)
diff --git a/webui/js/ponymail.js b/webui/js/ponymail.js
index c5e0579..4b409e5 100644
--- a/webui/js/ponymail.js
+++ b/webui/js/ponymail.js
@@ -2687,6 +2687,7 @@ function listview_threaded_element(thread, idx) {
******************************************/
let admin_current_email = null;
+let admin_email_meta = {};
let audit_entries = []
let audit_page = 0;
let audit_size = 30;
@@ -2705,8 +2706,44 @@ async function POST(url, formdata, state) {
return resp
}
-// Deletes (hides) an email from the archives
+// Hides an email from the archives
async function admin_hide_email() {
+ if (!confirm("Are you sure you wish to hide this email from the archives?")) {
+ return
+ }
+ formdata = JSON.stringify({
+ action: "hide",
+ document: admin_current_email
+ });
+ let rv = await POST('%sapi/mgmt.json'.format(apiURL), formdata, {});
+ let response = await rv.text();
+ if (rv.status == 200) {
+ modal("Email hidden", "Server responded with: " + response, "help");
+ } else {
+ modal("Something went wrong!", "Server responded with: " + response, "error");
+ }
+}
+
+async function admin_unhide_email() {
+ if (!confirm("Are you sure you wish to unhide this email?")) {
+ return
+ }
+ formdata = JSON.stringify({
+ action: "unhide",
+ document: admin_current_email
+ });
+ let rv = await POST('%sapi/mgmt.json'.format(apiURL), formdata, {});
+ let response = await rv.text();
+ if (rv.status == 200) {
+ modal("Email unhidden", "Server responded with: " + response, "help");
+ } else {
+ modal("Something went wrong!", "Server responded with: " + response, "error");
+ }
+}
+
+
+// Fully deletes an email from the archives
+async function admin_delete_email() {
if (!confirm("Are you sure you wish to remove this email from the archives?")) {
return
}
@@ -2750,6 +2787,7 @@ async function admin_save_email() {
function admin_email_preview(stats, json) {
admin_current_email = json.mid;
+ admin_email_meta = json;
let cp = document.getElementById("panel");
let div = new HTML('div', {
style: {
@@ -2894,23 +2932,42 @@ function admin_email_preview(stats, json) {
let btn_edit = new HTML('button', {
onclick: "admin_save_email();"
}, "Save changes to archive");
+ let btn_del = new HTML('button', {
+ onclick: "admin_delete_email();",
+ style: {
+ marginLeft: "36px",
+ color: 'red'
+ }
+ }, "Delete email from archives");
+
let btn_hide = new HTML('button', {
onclick: "admin_hide_email();",
style: {
marginLeft: "36px",
- color: 'red'
+ color: 'purple'
}
- }, "Remove email from archives");
+ }, "Hide email from archives");
+ if (admin_email_meta.deleted) {
+ btn_hide = new HTML('button', {
+ onclick: "admin_unhide_email();",
+ style: {
+ marginLeft: "36px",
+ color: 'purple'
+ }
+ }, "Unhide email from archives");
+ }
+
div.inject(new HTML('br'));
div.inject(btn_edit);
div.inject(btn_hide);
+ div.inject(btn_del);
div.inject(new HTML('br'));
div.inject(new HTML('small', {}, "Modifying emails will remove the option to view their sources via the web interface, as the source may contain traces that reveal the edit."))
div.inject(new HTML('br'));
if (!mgmt_prefs.login.credentials.fully_delete) {
- div.inject(new HTML('small', {}, "Emails that are removed may still be recovered by the base system administrator. For complete expungement, please contact the system administrator."))
+ div.inject(new HTML('small', {}, "Emails that are deleted may still be recovered by the base system administrator. For complete expungement, please contact the system administrator."))
} else {
- div.inject(new HTML('small', {style:{color: 'red'}}, "As GDPR enforcement is enabled on this server, emails are removed forever from the archive when deleted, and cannot be recovered."))
+ div.inject(new HTML('small', {style:{color: 'red'}}, "As full delete enforcement is enabled on this server, emails are removed forever from the archive when deleted, and cannot be recovered."))
}
}