diff options
Diffstat (limited to 'lib/gitlab/static_site_editor/config/generated_config.rb')
-rw-r--r-- | lib/gitlab/static_site_editor/config/generated_config.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/gitlab/static_site_editor/config/generated_config.rb b/lib/gitlab/static_site_editor/config/generated_config.rb index f3dce74a32f..ff24ec69ab0 100644 --- a/lib/gitlab/static_site_editor/config/generated_config.rb +++ b/lib/gitlab/static_site_editor/config/generated_config.rb @@ -4,8 +4,6 @@ module Gitlab module StaticSiteEditor module Config class GeneratedConfig - SUPPORTED_EXTENSIONS = %w[.md].freeze - def initialize(repository, ref, path, return_url) @repository = repository @ref = ref @@ -23,7 +21,7 @@ module Gitlab project: project.path, namespace: project.namespace.full_path, return_url: sanitize_url(return_url), - is_supported_content: supported_content?.to_s, + is_supported_content: supported_content?, base_url: Gitlab::Routing.url_helpers.project_show_sse_path(project, full_path), merge_requests_illustration_path: merge_requests_illustration_path } @@ -35,8 +33,12 @@ module Gitlab delegate :project, to: :repository + def supported_extensions + %w[.md].freeze + end + def commit_id - repository.commit(ref)&.id if ref + repository.commit(ref)&.id end def supported_content? @@ -50,7 +52,7 @@ module Gitlab def extension_supported? return true if path.end_with?('.md.erb') && Feature.enabled?(:sse_erb_support, project) - SUPPORTED_EXTENSIONS.any? { |ext| path.end_with?(ext) } + supported_extensions.any? { |ext| path.end_with?(ext) } end def file_exists? |