From 33dbbd0d6226d9d0ec95cc04aa183c20d5d58bd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Tue, 9 Oct 2018 17:41:41 +0200 Subject: [PATCH] Fix loading if no comments are available MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- js/controller/ActivityController.js | 8 ++++++-- js/service/ActivityService.js | 6 ++++-- templates/part.card.activity.html | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/js/controller/ActivityController.js b/js/controller/ActivityController.js index cbbcf8323..847a36976 100644 --- a/js/controller/ActivityController.js +++ b/js/controller/ActivityController.js @@ -46,12 +46,16 @@ class ActivityController { return self.element.id; }, function (params) { if (self.getData(self.element.id).length === 0) { - self.activityservice.loadComments(self.element.id); + if (self.type === 'deck_card') { + self.activityservice.loadComments(self.element.id); + } self.loading = true; self.fetchUntilResults(); } self.activityservice.fetchNewerActivities(self.type, self.element.id).then(function () {}); - self.cardservice.getCurrent().commentsUnread = 0; + if (self.type === 'deck_card') { + self.cardservice.getCurrent().commentsUnread = 0; + } }, true); let $target = $('.newCommentForm .message'); diff --git a/js/service/ActivityService.js b/js/service/ActivityService.js index 903009ed2..c8da9fd37 100644 --- a/js/service/ActivityService.js +++ b/js/service/ActivityService.js @@ -124,7 +124,7 @@ class ActivityService { self.running = false; return response; }, function (error) { - if (error.status === 304) { + if (error.status === 304 || error.status === 404) { self.since[type][id].finished = true; } self.running = false; @@ -140,7 +140,9 @@ class ActivityService { if (!this.since[type][id].finished) { this.runningPromise = this.fetchCardActivities(type, id, this.since[type][id].oldest); this.runningPromise.then(function() { - self.commentCollection.fetchNext(); + if (type === 'deck_card') { + self.commentCollection.fetchNext(); + } }); return this.runningPromise; } diff --git a/templates/part.card.activity.html b/templates/part.card.activity.html index dde8ad76f..be0163b11 100644 --- a/templates/part.card.activity.html +++ b/templates/part.card.activity.html @@ -1,5 +1,5 @@
-
+
{{ $ctrl.currentUser.displayName }}