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 a1895b84d76fdd73990ed3bdf6cb62beedf53fce
Author: Daniel Gruno <[email protected]>
AuthorDate: Mon Nov 15 18:45:22 2021 +0100

    regen JS
---
 webui/js/ponymail.js | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/webui/js/ponymail.js b/webui/js/ponymail.js
index 0af10ae..b9acdde 100644
--- a/webui/js/ponymail.js
+++ b/webui/js/ponymail.js
@@ -899,6 +899,24 @@ function construct_single_thread(state, json) {
     }
     let div = document.getElementById('emails');
     div.innerHTML = "";
+
+    // Fix URLs if they point to an deprecated permalink
+    if (json.thread) {
+        let url_to_push = location.href.replace(/[^/]+$/, "") + json.thread.id;
+        if (location.href != url_to_push) {
+            console.log("URL differs from default permalink, pushing correct 
ID to history.");
+            window.history.pushState({}, json.thread.subject, url_to_push)
+        }
+    }
+
+    // Not top level thread?
+    if (json.thread['in-reply-to'] && json.thread['in-reply-to'].length > 0) {
+        let notice = new HTML("span", {style: {color: "saddlebrown"}}, "This 
email appears to be a reply to another email. If you wish to attempt finding 
the root thread, click here: ");
+        let a = new HTML("a", {href: "javascript:void(location.href += 
'&find_parent=true');"}, "Find parent email");
+        div.inject(notice);
+        div.inject(a);
+    }
+
     if (chatty_layout) {
         let listname = json.thread.list_raw.replace(/[<>]/g, '').replace('.', 
'@', 1);
         div.setAttribute("class", "email_placeholder_chatty");

Reply via email to