Skip to content
Snippets Groups Projects
Commit ebff6f46 authored by Lukas Haase's avatar Lukas Haase
Browse files

add read motd to archive

parent a4e897f8
Branches
Tags
No related merge requests found
......@@ -19,16 +19,16 @@
</ars-col>
</ars-row>
<ars-row class="message" ars-flex-box>
<ng-container *ngFor="let message of motdsList.messagesNew">
<app-motd-message [message]="message"></app-motd-message>
<ng-container *ngFor="let message of motdsList.messages">
<app-motd-message *ngIf="!message.isRead && message.isNew" [message]="message"></app-motd-message>
</ng-container>
</ars-row>
<ars-row>
<h4 class="container-title">{{ 'footer.motd-title-old' | translate }}</h4>
</ars-row>
<ars-row class="message" ars-flex-box>
<ng-container *ngFor="let message of motdsList.messagesOld">
<app-motd-message [message]="message"></app-motd-message>
<ng-container *ngFor="let message of motdsList.messages">
<app-motd-message *ngIf="message.isRead || !message.isNew" [message]="message"></app-motd-message>
</ng-container>
</ars-row>
<ars-row [height]="32"></ars-row>
......
......@@ -4,6 +4,7 @@ export class MotdList {
public messagesNew: Motd[] = [];
public messagesOld: Motd[] = [];
public messages: Motd[] = [];
private localRead: string[];
constructor(
......@@ -16,6 +17,10 @@ export class MotdList {
this.localRead = JSON.parse(localStorage.getItem('motds'));
this.parse(this.messagesNew, messagesNew, true);
this.parse(this.messagesOld, messagesOld, false);
this.messages = this.messagesNew.concat(this.messagesOld);
this.sortList(this.messagesNew);
this.sortList(this.messagesOld);
this.sortList(this.messages);
}
private parse(list: Motd[], messages: any, isNew: boolean): void {
......@@ -34,6 +39,9 @@ export class MotdList {
});
list.push(motd);
});
}
private sortList(list: Motd[]) {
list.sort((a, b) => b.startTimestamp.getTime() - a.startTimestamp.getTime());
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment