From 3188e863b399446563c4952309f818c61bcfc079 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 9 Feb 2017 23:04:34 +0300 Subject: [PATCH] handle_rpc_json: fix netalert button never appearing on JSON parse error --- index.php | 3 +-- js/tt-rss.js | 18 +++++++++--------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/index.php b/index.php index 6e81bd61..e4cad9d0 100644 --- a/index.php +++ b/index.php @@ -232,8 +232,7 @@
diff --git a/js/tt-rss.js b/js/tt-rss.js index 36be92f4..4ed89d4b 100644 --- a/js/tt-rss.js +++ b/js/tt-rss.js @@ -994,14 +994,14 @@ function reverseHeadlineOrder() { } function handle_rpc_json(transport, scheduled_call) { - try { - var reply = JSON.parse(transport.responseText); - var netalert_dijit = dijit.byId("net-alert"); - var netalert = false; + var netalert_dijit = dijit.byId("net-alert"); + var netalert = false; + + if (netalert_dijit) netalert = netalert_dijit.domNode; - if (netalert_dijit) - netalert = netalert_dijit.domNode; + try { + var reply = JSON.parse(transport.responseText); if (reply) { @@ -1049,18 +1049,18 @@ function handle_rpc_json(transport, scheduled_call) { if (runtime_info) parse_runtime_info(runtime_info); - if (netalert) Element.hide(netalert); + if (netalert) netalert.hide(); } else { if (netalert) - Element.show(netalert); + netalert.show(); else notify_error("Communication problem with server."); } } catch (e) { if (netalert) - Element.show(netalert); + netalert.show(); else notify_error("Communication problem with server."); -- 2.39.5