From a9f3eeefff397c9f427c11e1b09c5be02a8e406a Mon Sep 17 00:00:00 2001 From: tecnovert Date: Fri, 21 Oct 2022 01:50:49 +0200 Subject: [PATCH] ui: Fix notifications. --- basicswap/basicswap.py | 2 +- basicswap/templates/header.html | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/basicswap/basicswap.py b/basicswap/basicswap.py index ac9b488..70705aa 100644 --- a/basicswap/basicswap.py +++ b/basicswap/basicswap.py @@ -1034,7 +1034,7 @@ class BasicSwap(BaseApp): def getNotifications(self): rv = [] for k, v in self._notifications_cache.items(): - rv.append((time.strftime('%d-%m-%y %H:%M:%S', time.localtime(k)), int(v[0]), json.dumps(v[1]))) + rv.append((time.strftime('%d-%m-%y %H:%M:%S', time.localtime(k)), int(v[0]), v[1])) return rv def vacuumDB(self): diff --git a/basicswap/templates/header.html b/basicswap/templates/header.html index 01787e1..c7e33e3 100644 --- a/basicswap/templates/header.html +++ b/basicswap/templates/header.html @@ -682,6 +682,15 @@ {% for entry in notifications %} console.log({{ entry[0] }}, {{ entry[1] }}, {{ entry[2] }}); + {% if entry[1] == 1 %} + console.log('new_offer {{ entry[2].offer_id }}'); + {% elif entry[1] == 2 %} + console.log('new_bid {{ entry[2].bid_id }} on {{ entry[2].offer_id }}'); + {% elif entry[1] == 3 %} + console.log('bid_accepted {{ entry[2].bid_id }}'); + {% else %} + console.log('Unknown event {{ entry[1] }}'); + {% endif %} {% endfor %} {% endif %}