From 04d8170fd7fc0dc2aac1611ff14c8459a084c352 Mon Sep 17 00:00:00 2001 From: Arnaud Levy <contact@arnaudlevy.com> Date: Mon, 5 Dec 2022 15:00:09 +0100 Subject: [PATCH] simpler --- app/models/communication/website/permalink.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/models/communication/website/permalink.rb b/app/models/communication/website/permalink.rb index 22148ea3e..7909853e1 100644 --- a/app/models/communication/website/permalink.rb +++ b/app/models/communication/website/permalink.rb @@ -51,9 +51,7 @@ class Communication::Website::Permalink < ApplicationRecord scope :not_current, -> { where(is_current: false) } def self.config_in_website(website) - MAPPING.values.select { |permalink_class| - permalink_class.required_for_website?(website) - }.map { |permalink_class| + config_required_in_website.map { |permalink_class| [permalink_class.static_config_key, permalink_class.pattern_in_website(website)] }.to_h end @@ -79,6 +77,12 @@ class Communication::Website::Permalink < ApplicationRecord protected + def self.config_required_in_website(website) + MAPPING.values.select { |permalink_class| + permalink_class.required_for_website?(website) + } + end + def published? # Can be overwritten true -- GitLab