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/10 23:57:05 UTC
[incubator-ponymail-foal] 01/03: Correctly find the position of emails
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 c2b43724ff8d5d4c2ab284f6ac72fc9b841d651e
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Sat Dec 11 00:55:45 2021 +0100
Correctly find the position of emails
---
webui/js/source/listview-treeview.js | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/webui/js/source/listview-treeview.js b/webui/js/source/listview-treeview.js
index fdfe17f..eec91bc 100644
--- a/webui/js/source/listview-treeview.js
+++ b/webui/js/source/listview-treeview.js
@@ -15,6 +15,16 @@
limitations under the License.
*/
+function email_idx(email) {
+ // Locates the index position of an email in our current json storage
+ for (const [idx, eml] of G_current_json.emails.entries()) {
+ if (eml.id === email.id) {
+ return idx
+ }
+ }
+ return 0
+}
+
function listview_treeview(json, start) {
let list = document.getElementById('emails');
list.innerHTML = "";
@@ -32,7 +42,7 @@ function listview_treeview(json, start) {
for (let n = s; n < (s + G_current_per_page); n++) {
let z = email_ordered.length - n - 1; // reverse order by default
if (email_ordered[z]) {
- let item = listview_flat_element(email_ordered[z], z);
+ let item = listview_flat_element(email_ordered[z], email_idx(email_ordered[z]));
list.inject(item);
// Hidden placeholder for expanding email(s)