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 6ef9970af7817ae8d862adb3244e39dce78ebdbe
Author: Daniel Gruno <[email protected]>
AuthorDate: Mon Nov 15 18:31:24 2021 +0100

    fix URLs if they differ from default permalink
---
 webui/js/source/construct-thread.js | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/webui/js/source/construct-thread.js 
b/webui/js/source/construct-thread.js
index 548e52f..815431e 100644
--- a/webui/js/source/construct-thread.js
+++ b/webui/js/source/construct-thread.js
@@ -124,6 +124,15 @@ 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) {
+            window.history.pushState({}, json.thread.subject, url_to_push)
+        }
+    }
+
     if (chatty_layout) {
         let listname = json.thread.list_raw.replace(/[<>]/g, '').replace('.', 
'@', 1);
         div.setAttribute("class", "email_placeholder_chatty");

Reply via email to