From a27eddd61131c3bfec552ccc1372d31f7f7bc949 Mon Sep 17 00:00:00 2001
From: Antonin Coquet <ext.sopra.acoquet@grandlyon.com>
Date: Thu, 20 May 2021 11:54:56 +0200
Subject: [PATCH 1/2] fix: display 'a la une' posts in the list when multiple
 'a la une'

---
 src/app/post/components/post-list/post-list.component.ts | 5 +++++
 src/app/post/services/post.service.ts                    | 4 +---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/app/post/components/post-list/post-list.component.ts b/src/app/post/components/post-list/post-list.component.ts
index 1d9b13b12..037b3631b 100644
--- a/src/app/post/components/post-list/post-list.component.ts
+++ b/src/app/post/components/post-list/post-list.component.ts
@@ -74,6 +74,11 @@ export class PostListComponent implements OnInit {
       } else {
         // Init default news list
         this.postService.getPosts(1).subscribe((news) => {
+          if (this.bigNews) {
+            news.posts = news.posts.filter((elem) => {
+              return elem.id != this.bigNews.id;
+            });
+          }
           this.setNews(news);
         });
       }
diff --git a/src/app/post/services/post.service.ts b/src/app/post/services/post.service.ts
index 4bc4076da..70423382e 100644
--- a/src/app/post/services/post.service.ts
+++ b/src/app/post/services/post.service.ts
@@ -26,9 +26,7 @@ export class PostService {
   public getPosts(page: number, tags?: string[]): Observable<PostWithMeta> {
     if (!tags) {
       return this.http
-        .get<PostWithMeta>(
-          `${this.baseUrl}?page=${page}&include=tags,authors&filter=tag:-[${TagEnum.aLaUne},${TagEnum.appels}]`
-        )
+        .get<PostWithMeta>(`${this.baseUrl}?page=${page}&include=tags,authors&filter=tag:-[${TagEnum.appels}]`)
         .pipe(map((item: PostWithMeta) => new PostWithMeta(item)));
     }
     let tagsString = '';
-- 
GitLab


From 3410a069d65d5d3775ec4a8a0d98fd7e3692eeba Mon Sep 17 00:00:00 2001
From: Antonin Coquet <ext.sopra.acoquet@grandlyon.com>
Date: Thu, 20 May 2021 14:15:05 +0200
Subject: [PATCH 2/2] fix: minor changes to optimize

---
 .../post/components/post-list/post-list.component.ts   | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/app/post/components/post-list/post-list.component.ts b/src/app/post/components/post-list/post-list.component.ts
index 037b3631b..14f617978 100644
--- a/src/app/post/components/post-list/post-list.component.ts
+++ b/src/app/post/components/post-list/post-list.component.ts
@@ -74,11 +74,6 @@ export class PostListComponent implements OnInit {
       } else {
         // Init default news list
         this.postService.getPosts(1).subscribe((news) => {
-          if (this.bigNews) {
-            news.posts = news.posts.filter((elem) => {
-              return elem.id != this.bigNews.id;
-            });
-          }
           this.setNews(news);
         });
       }
@@ -155,6 +150,11 @@ export class PostListComponent implements OnInit {
 
   // Split news on two columns on desktop mode or one column in mobile mode.
   private setNews(news: PostWithMeta): void {
+    if (this.bigNews) {
+      news.posts = news.posts.filter((elem) => {
+        return elem.id != this.bigNews.id;
+      });
+    }
     this.pagination = news.meta.pagination;
     const customIndex = this.postsMobileView.length; // For scroll loading, start with previous index.
     news.posts.forEach((val, index) => {
-- 
GitLab