Fix loading if no comments are available

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2018-10-09 17:41:41 +02:00
parent 72fd0fcc9b
commit 33dbbd0d62
3 changed files with 11 additions and 5 deletions

View File

@@ -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');

View File

@@ -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;
}

View File

@@ -1,5 +1,5 @@
<div id="commentsTabView">
<div class="newCommentRow comment" data-id="">
<div class="newCommentRow comment" data-id="" ng-show="$ctrl.type === 'deck_card'">
<div class="authorRow">
<div class="avatardiv" avatar ng-attr-user="{{ $ctrl.currentUser.uid }}" ng-attr-displayname="{{ $ctrl.currentUser.displayName }}" ng-attr-size="24"></div>
<div class="author currentUser">{{ $ctrl.currentUser.displayName }}</div>