From a44912e0737ac96c72a131c11aa9acf9f368bb02 Mon Sep 17 00:00:00 2001 From: Hugo SUBTIL <ext.sopra.husubtil@grandlyon.com> Date: Fri, 21 May 2021 15:44:08 +0200 Subject: [PATCH] fix(news): 'a-la-une' tag was creating bug in other news display. Multiple 'a-la-une' tag is now possible. --- 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..14f617978 100644 --- a/src/app/post/components/post-list/post-list.component.ts +++ b/src/app/post/components/post-list/post-list.component.ts @@ -150,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) => { 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