From 4f1b0b5c1a7daa4862b278e210bf4e5ddf8b9982 Mon Sep 17 00:00:00 2001
From: Hugo SUBTIL <ext.sopra.husubtil@grandlyon.com>
Date: Mon, 7 Feb 2022 12:30:13 +0100
Subject: [PATCH 1/2] chore(release): 1.13.0

---
 CHANGELOG.md      | 19 +++++++++++++++++++
 package-lock.json |  2 +-
 package.json      |  2 +-
 3 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7f6e3c6be..9ec95edb1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,25 @@
 
 All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
 
+## [1.13.0](https://forge.grandlyon.com/web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_client/compare/v1.12.0...v1.13.0) (2022-02-07)
+
+
+### ⚠ BREAKING CHANGES
+
+* app is now working with PWA handling
+
+### Features
+
+* add pwa handling ([d951ced](https://forge.grandlyon.com/web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_client/commit/d951ced8a2641fa42b441da47fe1304b05e78c15))
+* **pages:** display pages from ghost (eg. : about page and accessibility page) ([64ce8ca](https://forge.grandlyon.com/web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_client/commit/64ce8ca54ea67210436a267242435c25d5987609))
+
+
+### Bug Fixes
+
+* **footer:** temporarily hide accessibility link in footer until page is ready ([5cd7490](https://forge.grandlyon.com/web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_client/commit/5cd7490c5b2b1b656f13b39c01c125a03247dc13))
+* **pwa:** ghost caching in pwa was making ui unavailable ([d845a32](https://forge.grandlyon.com/web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_client/commit/d845a32a3abf1e4d269c79c59cc01f9744687721))
+* **pwa:** typo in update notification ([6734cfe](https://forge.grandlyon.com/web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_client/commit/6734cfec748b3952a417c6809200bf7f64b49430))
+
 ## [1.12.0](https://forge.grandlyon.com/web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_client/compare/v1.11.1...v1.12.0) (2022-02-01)
 
 
diff --git a/package-lock.json b/package-lock.json
index fca33e92c..820b6fdb1 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
 {
   "name": "pamn",
-  "version": "1.12.0",
+  "version": "1.13.0",
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {
diff --git a/package.json b/package.json
index 3211e38a6..8356afdb9 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "pamn",
-  "version": "1.12.0",
+  "version": "1.13.0",
   "scripts": {
     "ng": "ng",
     "start": "ng serve --configuration=fr --proxy-config proxy.conf.json",
-- 
GitLab


From 70990035c6c417ad82f00c5d560e239c7d9a86fe Mon Sep 17 00:00:00 2001
From: Hugo SUBTIL <ext.sopra.husubtil@grandlyon.com>
Date: Mon, 7 Feb 2022 14:06:10 +0000
Subject: [PATCH 2/2] fix(news): issue on news display, tag duplication and
 page display were broken

---
 .gitlab-ci.yml                                | 10 +++++++++
 .../post-list/post-list.component.ts          | 22 ++++++++++++++-----
 2 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 83fc5a0b6..4fce8137e 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -3,6 +3,16 @@ stages:
   - build
   - deploy
 
+build_branch:
+  image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/docker:18.09
+  services:
+    - docker:18.09-dind
+  stage: build
+  script:
+    - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
+    - docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" --build-arg conf=prod .
+    - docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
+
 build:
   image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/docker:18.09
   services:
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 77a3b17da..e0e7f0e46 100644
--- a/src/app/post/components/post-list/post-list.component.ts
+++ b/src/app/post/components/post-list/post-list.component.ts
@@ -60,15 +60,24 @@ export class PostListComponent implements OnInit {
         this.getPosts(this.filters);
       } else {
         // Init default news list
+        this.allPosts = [];
         this.postService.getPosts(1).subscribe((news) => {
-          this.setNews(news);
-          const headLineTag = this.allPosts.find((post: Post) => post.tags.some((tag) => tag.slug === TagEnum.aLaUne));
-          this.allPosts.unshift(headLineTag);
+          this.fillArticles(news);
         });
       }
     });
   }
 
+  public fillArticles(news: PostWithMeta): void {
+    this.setNews(news);
+    const headLineTag = this.allPosts.filter((post: Post) => post.tags.some((tag) => tag.slug === TagEnum.aLaUne));
+
+    const headIndex = this.allPosts.findIndex((post) => post.id === headLineTag[0].id);
+    this.allPosts.splice(headIndex, 1);
+
+    this.allPosts = [...headLineTag, ...this.allPosts];
+  }
+
   public getPosts(filters?: Tag[]): void {
     // Parse filter
     let parsedFilters = null;
@@ -87,7 +96,7 @@ export class PostListComponent implements OnInit {
 
     this.isLoading = true;
     this.postService.getPosts(1, parsedFilters).subscribe((news) => {
-      this.setNews(news);
+      this.fillArticles(news);
     });
   }
 
@@ -121,7 +130,7 @@ export class PostListComponent implements OnInit {
     if (this.pagination && this.pagination.page < this.pagination.pages) {
       this.isLoading = true;
       this.postService.getPosts(this.pagination.next).subscribe((news) => {
-        this.setNews(news);
+        this.fillArticles(news);
       });
     }
   }
@@ -130,11 +139,12 @@ export class PostListComponent implements OnInit {
   private setNews(news: PostWithMeta): void {
     this.pagination = news.meta.pagination;
     const customIndex = this.allPosts.length; // For scroll loading, start with previous index.
-    this.allPosts = news.posts.map((val, index) => {
+    const newPosts = news.posts.map((val, index) => {
       val = this.addAuthorToPost(val);
       index += customIndex;
       return val;
     });
+    this.allPosts = [...this.allPosts, ...newPosts];
     this.isLoading = false;
   }
 
-- 
GitLab