File tree Expand file tree Collapse file tree
src/app/core/notifications Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import { AuthService } from '../auth/services/auth.service';
77import { TaskStatus } from '../api/models/task-status.enum' ;
88import { Subscription } from 'rxjs' ;
99
10- const LAST_READ_STORAGE_KEY = 'task_management.notifications.last_read_at' ;
10+ const LAST_READ_STORAGE_KEY_PREFIX = 'task_management.notifications.last_read_at' ;
1111const NOTIFICATION_LIMIT = 50 ;
1212
1313export interface ActivityNotificationItem {
@@ -185,7 +185,7 @@ export class ActivityNotificationService {
185185 }
186186
187187 private readLastReadAtMs ( ) : number {
188- const value = localStorage . getItem ( LAST_READ_STORAGE_KEY ) ;
188+ const value = localStorage . getItem ( this . getLastReadStorageKey ( ) ) ;
189189 if ( ! value ) {
190190 return 0 ;
191191 }
@@ -195,6 +195,15 @@ export class ActivityNotificationService {
195195 }
196196
197197 private writeLastReadAt ( value : string ) : void {
198- localStorage . setItem ( LAST_READ_STORAGE_KEY , value ) ;
198+ localStorage . setItem ( this . getLastReadStorageKey ( ) , value ) ;
199+ }
200+
201+ private getLastReadStorageKey ( ) : string {
202+ const userId = this . authService . currentUserId ( ) ;
203+ if ( ! userId || userId . trim ( ) . length === 0 ) {
204+ return `${ LAST_READ_STORAGE_KEY_PREFIX } .anonymous` ;
205+ }
206+
207+ return `${ LAST_READ_STORAGE_KEY_PREFIX } .${ userId } ` ;
199208 }
200209}
You can’t perform that action at this time.
0 commit comments