From 3c6d137bf12d7a997921246954d2a20418048e46 Mon Sep 17 00:00:00 2001 From: Son NK <> Date: Sat, 23 May 2020 22:52:35 +0200 Subject: [PATCH] =?UTF-8?q?Only=20show=20notification=20icon=20when=20ther?= =?UTF-8?q?e's=20at=20least=201=20notification.=20Only=20show=20"load=20mo?= =?UTF-8?q?re"=20when=20there's=20more=20=F0=9F=99=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/footer.html | 12 ++++++++---- templates/header.html | 3 ++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/templates/footer.html b/templates/footer.html index fdc987ce..ed994c53 100644 --- a/templates/footer.html +++ b/templates/footer.html @@ -57,7 +57,8 @@ notifications: [], page: 0, loading: true, - canLoadMore: true + canLoadMore: false, + showNotification: false, }, computed: { has_non_read_notification: function () { @@ -94,8 +95,8 @@ }); if (res.ok) { let json = await res.json(); - if (json.length == 0) that.canLoadMore = false; - that.notifications = that.notifications.concat(json); + that.canLoadMore = json.more; + that.notifications = that.notifications.concat(json.notifications); } } @@ -110,8 +111,11 @@ }); if (res.ok) { let json = await res.json(); - that.notifications = json; + that.notifications = json.notifications; that.loading = false; + that.canLoadMore = json.more + if (that.notifications.length > 0) + that.showNotification = true; } } }) diff --git a/templates/header.html b/templates/header.html index 84e18f32..667ab045 100644 --- a/templates/header.html +++ b/templates/header.html @@ -15,7 +15,8 @@ {% endif %} -