Stop read notifications after user logouts
This commit is contained in:
@@ -101,7 +101,7 @@ export class SidenavComponent implements OnInit, AfterViewInit {
|
|||||||
*/
|
*/
|
||||||
getFrequentActivities() {
|
getFrequentActivities() {
|
||||||
const frequencyCounts: any = {};
|
const frequencyCounts: any = {};
|
||||||
let index = this.userActivity.length;
|
let index = this.userActivity?.length;
|
||||||
while (index) {
|
while (index) {
|
||||||
frequencyCounts[this.userActivity[--index]] = (frequencyCounts[this.userActivity[index]] || 0) + 1;
|
frequencyCounts[this.userActivity[--index]] = (frequencyCounts[this.userActivity[index]] || 0) + 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,7 +66,7 @@
|
|||||||
</button>
|
</button>
|
||||||
|
|
||||||
<div #notifications>
|
<div #notifications>
|
||||||
<mifosx-notifications-tray fxHide.lt-md></mifosx-notifications-tray>
|
<mifosx-notifications-tray #notificationsTray fxHide.lt-md></mifosx-notifications-tray>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div #themeToggle>
|
<div #themeToggle>
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import { ConfigurationWizardService } from '../../../configuration-wizard/config
|
|||||||
|
|
||||||
/** Custom Components */
|
/** Custom Components */
|
||||||
import { ConfigurationWizardComponent } from '../../../configuration-wizard/configuration-wizard.component';
|
import { ConfigurationWizardComponent } from '../../../configuration-wizard/configuration-wizard.component';
|
||||||
|
import { NotificationsTrayComponent } from 'app/shared/notifications-tray/notifications-tray.component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Toolbar component.
|
* Toolbar component.
|
||||||
@@ -46,6 +47,7 @@ export class ToolbarComponent implements OnInit, AfterViewInit, AfterContentChec
|
|||||||
@ViewChild('appMenu') appMenu: ElementRef<any>;
|
@ViewChild('appMenu') appMenu: ElementRef<any>;
|
||||||
/* Template for popover on appMenu */
|
/* Template for popover on appMenu */
|
||||||
@ViewChild('templateAppMenu') templateAppMenu: TemplateRef<any>;
|
@ViewChild('templateAppMenu') templateAppMenu: TemplateRef<any>;
|
||||||
|
@ViewChild('notificationsTray') notificationsTray: NotificationsTrayComponent;
|
||||||
|
|
||||||
/** Subscription to breakpoint observer for handset. */
|
/** Subscription to breakpoint observer for handset. */
|
||||||
isHandset$: Observable<boolean> = this.breakpointObserver
|
isHandset$: Observable<boolean> = this.breakpointObserver
|
||||||
@@ -112,7 +114,10 @@ export class ToolbarComponent implements OnInit, AfterViewInit, AfterContentChec
|
|||||||
* Logs out the authenticated user and redirects to login page.
|
* Logs out the authenticated user and redirects to login page.
|
||||||
*/
|
*/
|
||||||
logout() {
|
logout() {
|
||||||
this.authenticationService.logout().subscribe(() => this.router.navigate(['/login'], { replaceUrl: true }));
|
this.authenticationService.logout().subscribe(() => {
|
||||||
|
this.notificationsTray.destroy();
|
||||||
|
this.router.navigate(['/login'], { replaceUrl: true });
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ export class DashboardComponent implements OnInit {
|
|||||||
*/
|
*/
|
||||||
getFrequentActivities() {
|
getFrequentActivities() {
|
||||||
const frequencyCounts: any = {};
|
const frequencyCounts: any = {};
|
||||||
let index = this.userActivity.length;
|
let index = this.userActivity?.length;
|
||||||
while (index) {
|
while (index) {
|
||||||
frequencyCounts[this.userActivity[--index]] = (frequencyCounts[this.userActivity[index]] || 0) + 1;
|
frequencyCounts[this.userActivity[--index]] = (frequencyCounts[this.userActivity[index]] || 0) + 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,6 +64,10 @@ export class NotificationsTrayComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
|
this.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
public destroy() {
|
||||||
clearTimeout(this.timer);
|
clearTimeout(this.timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user