Skip to content

Commit

Permalink
pony mail search result url does not work as link
Browse files Browse the repository at this point in the history
This fixes #255
  • Loading branch information
sebbASF committed May 1, 2024
1 parent 32e6e5b commit a36fb3e
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions webui/js/source/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,33 @@ function search(query, date) {
let listid = '%s@%s'.format(list, domain);
G_current_list = list;
G_current_domain = domain;
let newhref = "list?%s:%s:%s".format(listid, date, query);

let header_from = document.getElementById('header_from');
let header_subject = document.getElementById('header_subject');
let header_to = document.getElementById('header_to');
let header_body = document.getElementById('header_body');
let qparts = query.split('&'); // look for additional query options
if (qparts.length > 0) { // i.e. query + header bits
query = qparts.shift(); // Keep only the query
// store the values to be picked up below
for (let part of qparts) {
let hv = part.split('=',2);
if (hv[0] == 'header_from') {
header_from.value = hv[1];
}
if (hv[0] == 'header_subject') {
header_subject.value = hv[1];
}
if (hv[0] == 'header_to') {
header_to.value = hv[1];
}
if (hv[0] == 'header_body') {
header_body.value = hv[1];
}
// N.B. other options are currently ignored
}
}
let newhref = "list?%s:%s:%s".format(listid, date, query);
let sURL = '%sapi/stats.lua?d=%s&list=%s&domain=%s&q=%s'.format(
G_apiURL, encodeURIComponent(date), encodeURIComponent(list), encodeURIComponent(domain), encodeURIComponent(query)
);
Expand Down Expand Up @@ -95,4 +116,4 @@ function search_set_list(what) {
}
}
document.getElementById('q').setAttribute("placeholder", "Search %s...".format(whatxt));
}
}

0 comments on commit a36fb3e

Please sign in to comment.