From 2e6dbaf8abb11e753c9f8b254d44c9583585a27c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Gaya?= <sebastien.gaya@gmail.com> Date: Thu, 11 May 2023 18:08:19 +0200 Subject: [PATCH] fix --- app/models/communication/website/page.rb | 1 + app/models/communication/website/with_special_pages.rb | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/models/communication/website/page.rb b/app/models/communication/website/page.rb index 09d528436..c9936abd6 100644 --- a/app/models/communication/website/page.rb +++ b/app/models/communication/website/page.rb @@ -103,6 +103,7 @@ class Communication::Website::Page < ApplicationRecord end def references + [parent] + menu_items end diff --git a/app/models/communication/website/with_special_pages.rb b/app/models/communication/website/with_special_pages.rb index 52e36e59a..909be747f 100644 --- a/app/models/communication/website/with_special_pages.rb +++ b/app/models/communication/website/with_special_pages.rb @@ -28,6 +28,12 @@ module Communication::Website::WithSpecialPages def translate_special_page(type, language) # Not found for given language, we create it from the page in default_language original_special_page = pages.where(type: type.to_s, language_id: default_language_id).first - original_special_page.translate!(language) if original_special_page.present? + return unless original_special_page.present? + translated_special_page = original_special_page.translate!(language) + # When we translate a new post, it will generate the permalink by looking for the posts special page + # It will try to find it, or translate it if not found + # At this moment, we need to sync the page with git (in case it's already published) + translated_special_page.sync_with_git + translated_special_page end end -- GitLab