diff --git a/apps/transport/lib/transport_web/router.ex b/apps/transport/lib/transport_web/router.ex index 39ec8b7c28..cb9f5dfeb8 100644 --- a/apps/transport/lib/transport_web/router.ex +++ b/apps/transport/lib/transport_web/router.ex @@ -56,7 +56,6 @@ defmodule TransportWeb.Router do pipeline :reuser_space do plug(:browser) plug(:authentication_required, destination_path: "/infos_reutilisateurs") - plug(:check_reuser_space_enabled) end scope "/", OpenApiSpex.Plug do @@ -387,17 +386,6 @@ defmodule TransportWeb.Router do end end - def check_reuser_space_enabled(%Plug.Conn{} = conn, _) do - if TransportWeb.Session.display_reuser_space?(conn) do - conn - else - conn - |> put_flash(:info, dgettext("alert", "This feature is currently not available.")) - |> redirect(to: "/") - |> halt() - end - end - # Check that a secret key is passed in the URL in the `export_key` query parameter defp check_export_secret_key(%Plug.Conn{params: params} = conn, _) do export_key_value = Map.get(params, "export_key", "") diff --git a/apps/transport/lib/transport_web/session.ex b/apps/transport/lib/transport_web/session.ex index 27aebfad97..e8f73874a2 100644 --- a/apps/transport/lib/transport_web/session.ex +++ b/apps/transport/lib/transport_web/session.ex @@ -58,23 +58,6 @@ defmodule TransportWeb.Session do DB.Dataset.base_query() |> where([dataset: d], d.organization_id in ^org_ids) |> DB.Repo.exists?() end - @doc """ - A temporary helper method to determine if we should display "reuser space features". - Convenient method to find various entrypoints in the codebase: - - links and buttons to the reuser space - - follow dataset hearts (search results, dataset pages) - - reuser space - - Enable it for everybody but keep a "kill switch" to disable it quickly - by setting an environment variable and rebooting the app. - - transport.data.gouv.fr admins get access no matter what. - """ - def display_reuser_space?(%Plug.Conn{} = conn) do - feature_disabled = Application.fetch_env!(:transport, :disable_reuser_space) - admin?(conn) or not feature_disabled - end - @spec set_session_attribute_attribute(Plug.Conn.t(), binary(), boolean()) :: Plug.Conn.t() defp set_session_attribute_attribute(%Plug.Conn{} = conn, key, value) do current_user = current_user(conn) diff --git a/apps/transport/lib/transport_web/templates/dataset/_header_links.html.heex b/apps/transport/lib/transport_web/templates/dataset/_header_links.html.heex index 0515fd571d..25a3964251 100644 --- a/apps/transport/lib/transport_web/templates/dataset/_header_links.html.heex +++ b/apps/transport/lib/transport_web/templates/dataset/_header_links.html.heex @@ -3,32 +3,30 @@ <%= link("Backoffice", to: backoffice_page_path(@conn, :edit, @dataset.id)) %> · <% end %> - <%= if TransportWeb.Session.display_reuser_space?(@conn) do %> - - <%= if @current_user do %> - <%= if @is_producer do %> - <%= link(dgettext("default", "Producer space"), - to: espace_producteur_path(@conn, :edit_dataset, @dataset.id, utm_campaign: "dataset_details"), + + <%= if @current_user do %> + <%= if @is_producer do %> + <%= link(dgettext("default", "Producer space"), + to: espace_producteur_path(@conn, :edit_dataset, @dataset.id, utm_campaign: "dataset_details"), + target: "_blank" + ) %> + <% else %> + <%= if @follows_dataset do %> + <%= link(dgettext("default", "Reuser space"), + to: reuser_space_path(@conn, :datasets_edit, @dataset.id, utm_campaign: "dataset_details"), target: "_blank" ) %> <% else %> - <%= if @follows_dataset do %> - <%= link(dgettext("default", "Reuser space"), - to: reuser_space_path(@conn, :datasets_edit, @dataset.id, utm_campaign: "dataset_details"), - target: "_blank" - ) %> - <% else %> - <%= link(dgettext("default", "Reuser space"), - to: reuser_space_path(@conn, :espace_reutilisateur, utm_campaign: "dataset_details"), - target: "_blank" - ) %> - <% end %> + <%= link(dgettext("default", "Reuser space"), + to: reuser_space_path(@conn, :espace_reutilisateur, utm_campaign: "dataset_details"), + target: "_blank" + ) %> <% end %> - <% else %> - <%= link(dgettext("default", "Reuser space"), - to: page_path(@conn, :infos_reutilisateurs, utm_campaign: "dataset_details"), - target: "_blank" - ) %> <% end %> + <% else %> + <%= link(dgettext("default", "Reuser space"), + to: page_path(@conn, :infos_reutilisateurs, utm_campaign: "dataset_details"), + target: "_blank" + ) %> <% end %> diff --git a/apps/transport/lib/transport_web/templates/dataset/details.html.heex b/apps/transport/lib/transport_web/templates/dataset/details.html.heex index 34e1553a13..686432d3a2 100644 --- a/apps/transport/lib/transport_web/templates/dataset/details.html.heex +++ b/apps/transport/lib/transport_web/templates/dataset/details.html.heex @@ -239,11 +239,9 @@
- <%= if TransportWeb.Session.display_reuser_space?(@conn) do %> - <%= live_render(@conn, TransportWeb.Live.FollowDatasetLive, - session: %{"current_user" => @current_user, "dataset_id" => @dataset.id} - ) %> - <% end %> + <%= live_render(@conn, TransportWeb.Live.FollowDatasetLive, + session: %{"current_user" => @current_user, "dataset_id" => @dataset.id} + ) %> diff --git a/apps/transport/lib/transport_web/templates/dataset/index.html.heex b/apps/transport/lib/transport_web/templates/dataset/index.html.heex index 4e301295fe..86a7d9e53e 100644 --- a/apps/transport/lib/transport_web/templates/dataset/index.html.heex +++ b/apps/transport/lib/transport_web/templates/dataset/index.html.heex @@ -196,9 +196,7 @@
- <%= if not is_nil(@current_user) and TransportWeb.Session.display_reuser_space?(@conn) do %> - - <% end %> + <%= unless is_nil(icon_type_path(dataset)) do %> <%= img_tag(icon_type_path(dataset), alt: dataset.type) %> <% end %> diff --git a/apps/transport/lib/transport_web/templates/layout/_header.html.heex b/apps/transport/lib/transport_web/templates/layout/_header.html.heex index 6e222369e7..3950024dfb 100644 --- a/apps/transport/lib/transport_web/templates/layout/_header.html.heex +++ b/apps/transport/lib/transport_web/templates/layout/_header.html.heex @@ -97,11 +97,9 @@ to: page_path(@conn, :espace_producteur, utm_campaign: "menu_dropdown") ) %> <% end %> - <%= if TransportWeb.Session.display_reuser_space?(@conn) do %> - <%= link(gettext("Reuser space"), - to: reuser_space_path(@conn, :espace_reutilisateur, utm_campaign: "menu_dropdown") - ) %> - <% end %> + <%= link(gettext("Reuser space"), + to: reuser_space_path(@conn, :espace_reutilisateur, utm_campaign: "menu_dropdown") + ) %> <%= dgettext("page-index", "Producer space") %> - <%= if TransportWeb.Session.display_reuser_space?(@conn) do %> - - <%= dgettext("page-index", "Reuser space") %> - - <% end %> + + <%= dgettext("page-index", "Reuser space") %> +