]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/shared-main/users/user-notifications.component.ts
Merge branch 'release/3.2.0' into develop
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-main / users / user-notifications.component.ts
index 7518dbdd0181b83da68e7ce6167ebd649af96709..d7c72235528ddef83bea36ac3ac9b82de4b096d3 100644 (file)
@@ -1,7 +1,7 @@
 import { Subject } from 'rxjs'
 import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'
 import { ComponentPagination, hasMoreItems, Notifier } from '@app/core'
-import { UserNotificationType } from '@shared/models'
+import { UserNotificationType, AbuseState } from '@shared/models'
 import { UserNotification } from './user-notification.model'
 import { UserNotificationService } from './user-notification.service'
 
@@ -21,9 +21,6 @@ export class UserNotificationsComponent implements OnInit {
   notifications: UserNotification[] = []
   sortField = 'createdAt'
 
-  // So we can access it in the template
-  UserNotificationType = UserNotificationType
-
   componentPagination: ComponentPagination
 
   onDataSubject = new Subject<any[]>()
@@ -48,7 +45,7 @@ export class UserNotificationsComponent implements OnInit {
   }
 
   loadNotifications (reset?: boolean) {
-    this.userNotificationService.listMyNotifications({
+    const options = {
       pagination: this.componentPagination,
       ignoreLoadingBar: this.ignoreLoadingBar,
       sort: {
@@ -56,7 +53,9 @@ export class UserNotificationsComponent implements OnInit {
         // if we order by creation date, we want DESC. all other fields are ASC (like unread).
         order: this.sortField === 'createdAt' ? -1 : 1
       }
-    })
+    }
+
+    this.userNotificationService.listMyNotifications(options)
         .subscribe(
           result => {
             this.notifications = reset ? result.data : this.notifications.concat(result.data)
@@ -116,4 +115,8 @@ export class UserNotificationsComponent implements OnInit {
     this.sortField = column
     this.loadNotifications(true)
   }
+
+  isAccepted (notification: UserNotification) {
+    return notification.abuse.state === AbuseState.ACCEPTED
+  }
 }