From 2cb0728bbb7bb6a11a5c8043a804e6fa1f7c2ad0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lukas=20Mau=C3=9F?= <lukas.mauss@mni.thm.de>
Date: Fri, 7 Jun 2019 15:15:32 +0200
Subject: [PATCH] Add unread filter

---
 .../shared/comment-list/comment-list.component.html           | 4 ++++
 .../components/shared/comment-list/comment-list.component.ts  | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/src/app/components/shared/comment-list/comment-list.component.html b/src/app/components/shared/comment-list/comment-list.component.html
index 2e1e46d8a..d9bc36525 100644
--- a/src/app/components/shared/comment-list/comment-list.component.html
+++ b/src/app/components/shared/comment-list/comment-list.component.html
@@ -56,6 +56,10 @@
         <mat-icon>visibility</mat-icon>
       </button>
 
+      <button mat-icon-button (focus)="hideCommentsList=true" (click)="filterMarkAsUnread()">
+        <mat-icon>visibility_off</mat-icon>
+      </button>
+
       <button mat-icon-button (focus)="hideCommentsList=false" (click)="sort(currentSort)">
         <mat-icon>close</mat-icon>
       </button>
diff --git a/src/app/components/shared/comment-list/comment-list.component.ts b/src/app/components/shared/comment-list/comment-list.component.ts
index 5d629039e..689465f6d 100644
--- a/src/app/components/shared/comment-list/comment-list.component.ts
+++ b/src/app/components/shared/comment-list/comment-list.component.ts
@@ -168,6 +168,10 @@ export class CommentListComponent implements OnInit {
     this.filteredComments = this.comments.filter(c => c.read);
   }
 
+  filterMarkAsUnread(): void {
+    this.filteredComments = this.comments.filter(c => !c.read);
+  }
+
   filterMarkAsCorrect(): void {
     this.filteredComments = this.comments.filter(c => c.correct);
   }
-- 
GitLab