ponymail-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [incubator-ponymail] branch master updated: duplication of data in response from thread.lua
Date Fri, 02 Mar 2018 20:09:37 GMT
This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail.git


The following commit(s) were added to refs/heads/master by this push:
     new a105f9a  duplication of data in response from thread.lua
a105f9a is described below

commit a105f9a3adfc1707574e4265356637dd96d0ef98
Author: Sebb <sebb@apache.org>
AuthorDate: Fri Mar 2 20:09:35 2018 +0000

    duplication of data in response from thread.lua
    
    This fixes #440
---
 CHANGELOG.md                           |  1 +
 site/api/thread.lua                    |  1 -
 site/js/dev/ponymail_email_displays.js |  4 ++--
 site/js/dev/ponymail_timetravel.js     | 18 +++++++++---------
 site/js/ponymail.js                    | 22 +++++++++++-----------
 5 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index c18abbe..d5dac29 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,5 @@
 ## Changes in 0.11-SNAPSHOT
+- Bug: duplication of data in response from thread.lua (#440)
 - Bug: Indentation in mail content (leading white-space) not shown (#432)
 - Bug: does not make sense to allow empty domain name in LID (#434)
 - Bug: Inconsistent LID validation (#356)
diff --git a/site/api/thread.lua b/site/api/thread.lua
index b32db2b..e7be4f7 100644
--- a/site/api/thread.lua
+++ b/site/api/thread.lua
@@ -112,7 +112,6 @@ function handle(r)
             --doc.body = nil
             r:puts(JSON.encode({
                 took = DEBUG and (r:clock() - START) or nil,
-                thread = doc,
                 emails = emls_thrd,
             }))
             return cross.OK
diff --git a/site/js/dev/ponymail_email_displays.js b/site/js/dev/ponymail_email_displays.js
index f0b2db1..313ffe1 100644
--- a/site/js/dev/ponymail_email_displays.js
+++ b/site/js/dev/ponymail_email_displays.js
@@ -462,8 +462,8 @@ function highlightNewEmails(id) {
 }
 
 function displaySingleThread(json) {
-    if (json && json.thread) {
-        current_thread_json = [json.thread]
+    if (json && json.emails[0]) {
+        current_thread_json = [json.emails[0]]
         current_flat_json = json.emails
     }
     var thread = document.getElementById('thread_0')
diff --git a/site/js/dev/ponymail_timetravel.js b/site/js/dev/ponymail_timetravel.js
index a2ca405..e30f536 100644
--- a/site/js/dev/ponymail_timetravel.js
+++ b/site/js/dev/ponymail_timetravel.js
@@ -18,8 +18,8 @@
 
 // simple func that just redirects to the original thread URL we just got if possible
 function timeTravelSingleThreadRedirect(json) {
-    if (json && json.thread) {
-        location.href = URL_BASE + "/thread.html/" + (pm_config.shortLinks ? shortenID(json.thread.mid)
: json.thread.mid)
+    if (json && json.emails[0]) {
+        location.href = URL_BASE + "/thread.html/" + (pm_config.shortLinks ? shortenID(json.emails[0].mid)
: json.emails[0].mid)
     }
 }
 
@@ -39,24 +39,24 @@ function timeTravelListRedirect(json, state) {
         }
     }
     // Did we receive timetravel data?
-    if (json && json.thread) {
+    if (json && json.emails[0]) {
         var osubs = countSubs(current_thread_json[state.id])
-        var nsubs = countSubs(json.thread)
+        var nsubs = countSubs(json.emails[0])
         var oid = current_thread_json[state.id].tid
         
         // Did we actually get more emails now than we had before?
-        if (nsubs > osubs || nsubs >= osubs && !json.thread.irt) {
+        if (nsubs > osubs || nsubs >= osubs && !json.emails[0].irt) {
             if (prefs.displayMode == 'threaded') {
                 toggleEmails_threaded(state.id)
-                current_thread_json[state.id] = json.thread
+                current_thread_json[state.id] = json.emails[0]
                 toggleEmails_threaded(state.id)
             } else if (prefs.displayMode == 'treeview') {
                 toggleEmails_treeview(state.id)
-                current_thread_json[state.id] = json.thread
+                current_thread_json[state.id] = json.emails[0]
                 toggleEmails_treeview(state.id)
             }
-            var subs = countSubs(json.thread)
-            var parts = countParts(json.thread)
+            var subs = countSubs(json.emails[0])
+            var parts = countParts(json.emails[0])
             // If we have subs/people labels available, change them and set the newly found
stats
             if (document.getElementById('subs_' + state.id) != null) {
                 document.getElementById('subs_' + state.id).innerHTML = "<span class='glyphicon
glyphicon-envelope'> </span> " + subs + " replies"
diff --git a/site/js/ponymail.js b/site/js/ponymail.js
index fe928b5..7fce8e2 100644
--- a/site/js/ponymail.js
+++ b/site/js/ponymail.js
@@ -1824,8 +1824,8 @@ function highlightNewEmails(id) {
 }
 
 function displaySingleThread(json) {
-    if (json && json.thread) {
-        current_thread_json = [json.thread]
+    if (json && json.emails[0]) {
+        current_thread_json = [json.emails[0]]
         current_flat_json = json.emails
     }
     var thread = document.getElementById('thread_0')
@@ -4721,8 +4721,8 @@ function showStats(json) {
 
 // simple func that just redirects to the original thread URL we just got if possible
 function timeTravelSingleThreadRedirect(json) {
-    if (json && json.thread) {
-        location.href = URL_BASE + "/thread.html/" + (pm_config.shortLinks ? shortenID(json.thread.mid)
: json.thread.mid)
+    if (json && json.emails[0]) {
+        location.href = URL_BASE + "/thread.html/" + (pm_config.shortLinks ? shortenID(json.emails[0].mid)
: json.emails[0].mid)
     }
 }
 
@@ -4742,24 +4742,24 @@ function timeTravelListRedirect(json, state) {
         }
     }
     // Did we receive timetravel data?
-    if (json && json.thread) {
+    if (json && json.emails[0]) {
         var osubs = countSubs(current_thread_json[state.id])
-        var nsubs = countSubs(json.thread)
+        var nsubs = countSubs(json.emails[0])
         var oid = current_thread_json[state.id].tid
         
         // Did we actually get more emails now than we had before?
-        if (nsubs > osubs || nsubs >= osubs && !json.thread.irt) {
+        if (nsubs > osubs || nsubs >= osubs && !json.emails[0].irt) {
             if (prefs.displayMode == 'threaded') {
                 toggleEmails_threaded(state.id)
-                current_thread_json[state.id] = json.thread
+                current_thread_json[state.id] = json.emails[0]
                 toggleEmails_threaded(state.id)
             } else if (prefs.displayMode == 'treeview') {
                 toggleEmails_treeview(state.id)
-                current_thread_json[state.id] = json.thread
+                current_thread_json[state.id] = json.emails[0]
                 toggleEmails_treeview(state.id)
             }
-            var subs = countSubs(json.thread)
-            var parts = countParts(json.thread)
+            var subs = countSubs(json.emails[0])
+            var parts = countParts(json.emails[0])
             // If we have subs/people labels available, change them and set the newly found
stats
             if (document.getElementById('subs_' + state.id) != null) {
                 document.getElementById('subs_' + state.id).innerHTML = "<span class='glyphicon
glyphicon-envelope'> </span> " + subs + " replies"

-- 
To stop receiving notification emails like this one, please contact
sebb@apache.org.

Mime
View raw message