From 4e0cf1cf3b51b0cb96e673be2bfcf074332953f0 Mon Sep 17 00:00:00 2001
From: Mario Celi <mcelicalderon@gitlab.com>
Date: Fri, 16 Feb 2024 11:24:20 -0500
Subject: [PATCH] Add new group level markdown_preview route

New route is properly scoped as
/groups/*group_id/-/markdown_preview
---
 config/routes.rb       | 2 ++
 config/routes/group.rb | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/config/routes.rb b/config/routes.rb
index 58389d47d134b..5e00dfac6056c 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -259,6 +259,8 @@
     resources(:groups, only: [:index, :new, :create]) do
       # The constraints ensure that the `group_id` parameter in the URL allows for multiple levels
       # of subgroups, permitting both regular and encoded slashes (%2F).
+      # Deprecated in favor of /groups/*group_id/-/preview_markdown
+      # https://gitlab.com/gitlab-org/gitlab/-/issues/442218
       post :preview_markdown, constraints: { group_id: %r{#{Gitlab::PathRegex.full_namespace_route_regex.source}(%2F#{Gitlab::PathRegex.full_namespace_route_regex.source})*} }
     end
 
diff --git a/config/routes/group.rb b/config/routes/group.rb
index 2de5938a0e7a5..eedad3c014c08 100644
--- a/config/routes/group.rb
+++ b/config/routes/group.rb
@@ -164,6 +164,8 @@
     resources :achievements, only: [:index, :new, :edit]
 
     resources :work_items, only: [:index, :show], param: :iid
+
+    post :preview_markdown
   end
 
   scope(
-- 
GitLab