RED-6174 - added default values for environment variables in case they are not available
This commit is contained in:
parent
59b04033cf
commit
4bd636887c
@ -13,6 +13,10 @@ import dayjs from 'dayjs';
|
||||
|
||||
const INCLUDE_SEEN = false;
|
||||
|
||||
const AVAILABLE_NOTIFICATIONS_DAYS = 30;
|
||||
const AVAILABLE_OLD_NOTIFICATIONS_MINUTES = 60;
|
||||
const NOTIFICATIONS_THRESHOLD = 1000;
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
@ -81,14 +85,17 @@ export class NotificationsService extends EntitiesService<INotification, Notific
|
||||
}
|
||||
|
||||
const creationDate = dayjs(n.creationDate);
|
||||
if (todayDate.diff(creationDate, 'day') <= this.#config.AVAILABLE_NOTIFICATIONS_DAYS) {
|
||||
if (todayDate.diff(creationDate, 'day') <= (this.#config.AVAILABLE_NOTIFICATIONS_DAYS ?? AVAILABLE_NOTIFICATIONS_DAYS)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return todayDate.diff(readDate, 'minute') <= this.#config.AVAILABLE_OLD_NOTIFICATIONS_MINUTES;
|
||||
return (
|
||||
todayDate.diff(readDate, 'minute') <=
|
||||
(this.#config.AVAILABLE_OLD_NOTIFICATIONS_MINUTES ?? AVAILABLE_OLD_NOTIFICATIONS_MINUTES)
|
||||
);
|
||||
});
|
||||
|
||||
return notifications.slice(0, this.#config.NOTIFICATIONS_THRESHOLD);
|
||||
return notifications.slice(0, this.#config.NOTIFICATIONS_THRESHOLD ?? NOTIFICATIONS_THRESHOLD);
|
||||
}
|
||||
|
||||
#loadNotificationsIfChanged(): Observable<Notification[]> {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user