diff options
Diffstat (limited to 'client/src/app/shared/users/user-notifications.component.ts')
-rw-r--r-- | client/src/app/shared/users/user-notifications.component.ts | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/client/src/app/shared/users/user-notifications.component.ts b/client/src/app/shared/users/user-notifications.component.ts index 682116226..b5f9fd399 100644 --- a/client/src/app/shared/users/user-notifications.component.ts +++ b/client/src/app/shared/users/user-notifications.component.ts | |||
@@ -13,17 +13,14 @@ import { UserNotification } from '@app/shared/users/user-notification.model' | |||
13 | export class UserNotificationsComponent implements OnInit { | 13 | export class UserNotificationsComponent implements OnInit { |
14 | @Input() ignoreLoadingBar = false | 14 | @Input() ignoreLoadingBar = false |
15 | @Input() infiniteScroll = true | 15 | @Input() infiniteScroll = true |
16 | @Input() itemsPerPage = 20 | ||
16 | 17 | ||
17 | notifications: UserNotification[] = [] | 18 | notifications: UserNotification[] = [] |
18 | 19 | ||
19 | // So we can access it in the template | 20 | // So we can access it in the template |
20 | UserNotificationType = UserNotificationType | 21 | UserNotificationType = UserNotificationType |
21 | 22 | ||
22 | componentPagination: ComponentPagination = { | 23 | componentPagination: ComponentPagination |
23 | currentPage: 1, | ||
24 | itemsPerPage: 10, | ||
25 | totalItems: null | ||
26 | } | ||
27 | 24 | ||
28 | constructor ( | 25 | constructor ( |
29 | private userNotificationService: UserNotificationService, | 26 | private userNotificationService: UserNotificationService, |
@@ -31,6 +28,12 @@ export class UserNotificationsComponent implements OnInit { | |||
31 | ) { } | 28 | ) { } |
32 | 29 | ||
33 | ngOnInit () { | 30 | ngOnInit () { |
31 | this.componentPagination = { | ||
32 | currentPage: 1, | ||
33 | itemsPerPage: this.itemsPerPage, // Reset items per page, because of the @Input() variable | ||
34 | totalItems: null | ||
35 | } | ||
36 | |||
34 | this.loadMoreNotifications() | 37 | this.loadMoreNotifications() |
35 | } | 38 | } |
36 | 39 | ||
@@ -57,6 +60,8 @@ export class UserNotificationsComponent implements OnInit { | |||
57 | } | 60 | } |
58 | 61 | ||
59 | markAsRead (notification: UserNotification) { | 62 | markAsRead (notification: UserNotification) { |
63 | if (notification.read) return | ||
64 | |||
60 | this.userNotificationService.markAsRead(notification) | 65 | this.userNotificationService.markAsRead(notification) |
61 | .subscribe( | 66 | .subscribe( |
62 | () => { | 67 | () => { |