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/06/06 08:42:44 UTC

[incubator-ponymail-foal] branch master updated: Prepare for simplifying error responses

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


The following commit(s) were added to refs/heads/master by this push:
     new 661c18a  Prepare for simplifying error responses
661c18a is described below

commit 661c18a8808e5f2def8c0a06b1c456a06d04ab0e
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Sun Jun 6 10:42:40 2021 +0200

    Prepare for simplifying error responses
---
 webui/js/source/construct-thread.js | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/webui/js/source/construct-thread.js b/webui/js/source/construct-thread.js
index b36f6c3..d675aff 100644
--- a/webui/js/source/construct-thread.js
+++ b/webui/js/source/construct-thread.js
@@ -100,9 +100,13 @@ function construct_thread(thread, cid, nestlevel, included) {
 // Singular thread construction via permalinks
 function construct_single_thread(state, json) {
     current_json = json;
-    if (json && json.error) {
-        modal("An error occured", "Sorry, we hit a snag while trying to load the email(s): \n\n%s".format(json.error), "error");
-        return;
+    if (json) {
+        // Old schema has json.error filled on error, simplified schema has json.message filled and json.okay set to false
+        let error_message = json.okay === false ? json.message : json.error;
+        if (error_message) {
+            modal("An error occured", "Sorry, we hit a snag while trying to load the email(s): \n\n%s".format(error_message), "error");
+            return;
+        }
     }
     let div = document.getElementById('emails');
     div.innerHTML = "";