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/12/29 17:07:05 UTC

[incubator-ponymail-foal] 01/02: Allow for specific list ID when querying by message-id

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 723b4fde2f5f1bdb8b5ea1d2a1d1ff49df92dc6a
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Wed Dec 29 18:06:26 2021 +0100

    Allow for specific list ID when querying by message-id
---
 webui/js/source/primer.js | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/webui/js/source/primer.js b/webui/js/source/primer.js
index cbec6fc..30c6bc4 100644
--- a/webui/js/source/primer.js
+++ b/webui/js/source/primer.js
@@ -150,17 +150,30 @@ function parseURL(state) {
 function parse_permalink() {
     // message id is the bit after the last /
     let mid = location.href.split('/').pop();
-    // Cut off any query string there might be
-    if (mid.match(/\?/)) {
-        mid = mid.replace(/\?.*$/, '');
+    mid = mid.replace(/\?.*/, '');  // Chop away any query string
+    // List-ID specified?
+    const query = unescape(location.search.substr(1));
+    let list_id = null;
+    if (query.length) {
+        if (query.match(/^<.+>$/)) {
+            list_id = query;
+        }
     }
+
     mid = unshortenID(mid);  // In case of old school shortened links
     init_preferences(); // blank call to load defaults like social rendering
     GET('%sapi/preferences.lua'.format(G_apiURL), init_preferences, null);
     // Fetch the thread data and pass to build_single_thread
-    GET('%sapi/thread.lua?id=%s'.format(G_apiURL, mid), construct_single_thread, {
-        cached: true
-    });
+    if (list_id) {
+        GET('%sapi/thread.lua?id=%s&list=%s'.format(G_apiURL, mid, list_id), construct_single_thread, {
+            cached: true
+        });
+    }
+    else {
+        GET('%sapi/thread.lua?id=%s'.format(G_apiURL, mid), construct_single_thread, {
+            cached: true
+        });
+    }
 }