Update NotificationCard, fix missing status bug

This commit is contained in:
Daniel Supernault 2021-06-18 05:29:37 -06:00
parent ef63124d88
commit a3a86d46a1
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -130,8 +130,19 @@
fetchNotifications() { fetchNotifications() {
axios.get('/api/pixelfed/v1/notifications?pg=true') axios.get('/api/pixelfed/v1/notifications?pg=true')
.then(res => { .then(res => {
let data = res.data; let data = res.data.filter(n => {
let ids = res.data.map(n => n.id); if(n.type == 'share' && !status) {
return false;
}
if(n.type == 'comment' && !status) {
return false;
}
if(n.type == 'mention' && !status) {
return false;
}
return true;
});
let ids = data.map(n => n.id);
this.notificationMaxId = Math.min(...ids); this.notificationMaxId = Math.min(...ids);
this.notifications = data; this.notifications = data;
this.loading = false; this.loading = false;
@ -154,11 +165,19 @@
if(n.type == 'share' && !status) { if(n.type == 'share' && !status) {
return false; return false;
} }
if(n.type == 'comment' && !status) {
return false;
}
if(n.type == 'mention' && !status) {
return false;
}
if(_.find(this.notifications, {id: n.id})) { if(_.find(this.notifications, {id: n.id})) {
return false; return false;
} }
return true; return true;
}); });
let ids = data.map(n => n.id);
this.notificationMaxId = Math.min(...ids);
this.notifications.push(...data); this.notifications.push(...data);
this.notificationCursor++; this.notificationCursor++;
$state.loaded(); $state.loaded();