Implement comment deletion and loading indicator

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2018-10-05 10:12:15 +02:00
parent e547a5d2b9
commit f5520d3087
6 changed files with 33 additions and 21 deletions

View File

@@ -53,11 +53,9 @@ class ActivityService {
let item = this.toEnhanceWithComments[index];
item.commentModel = this.commentCollection.get(item.subject_rich[1].comment);
if (typeof item.commentModel !== 'undefined') {
// FIXME: not working
this.toEnhanceWithComments.remove(item);
this.toEnhanceWithComments = this.toEnhanceWithComments.filter(entry => entry.id !== item.id);
}
}
console.log(this.toEnhanceWithComments);
var firstUnread = this.commentCollection.findWhere({isUnread: true});
if (typeof firstUnread !== 'undefined') {
this.commentCollection.updateReadMarker();
@@ -155,13 +153,15 @@ class ActivityService {
return;
}
item.timestamp = new Date(item.datetime).getTime();
item.type = 'activity';
if (item.subject_rich[1].comment) {
item.type = 'comment';
item.commentModel = this.commentCollection.get(item.subject_rich[1].comment);
if (typeof item.commentModel === 'undefined') {
this.toEnhanceWithComments.push(item);
}
}
this.data[type][id].push(item);
}