From 47efbf3ddb59a3a172eb23f63f1ae22c1621b8bf Mon Sep 17 00:00:00 2001 From: John Shaughnessy Date: Wed, 24 Nov 2021 16:08:10 -0500 Subject: [PATCH 1/3] Hide room name if the room is closed --- lib/ret_web/controllers/page_controller.ex | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/ret_web/controllers/page_controller.ex b/lib/ret_web/controllers/page_controller.ex index 68b2d83e2..56348d7f9 100644 --- a/lib/ret_web/controllers/page_controller.ex +++ b/lib/ret_web/controllers/page_controller.ex @@ -435,7 +435,7 @@ defmodule RetWeb.PageController do hub_meta_tags = Phoenix.View.render_to_string(RetWeb.PageView, "hub-meta.html", - hub: hub, + hub: hub |> maybe_scrub_room_name(), scene: hub.scene, ret_meta: Ret.Meta.get_meta(include_repo: false), available_integrations_script: {:safe, available_integrations_script |> with_script_tags}, @@ -792,4 +792,13 @@ defmodule RetWeb.PageController do defp with_script_tags(script), do: "" defp module_config(key), do: Application.get_env(:ret, __MODULE__)[key] + + defp maybe_scrub_room_name(hub) do + if hub.entry_mode == :deny do + Map.merge(hub, %{name: "Closed Room"}) + else + hub + end + end + end From 0be4f342cb9befc724e16abf89245ef5b1af9626 Mon Sep 17 00:00:00 2001 From: John Shaughnessy Date: Wed, 24 Nov 2021 19:38:20 -0500 Subject: [PATCH 2/3] Scrub other potentially sensitive room data before displaying it on the page --- lib/ret_web/controllers/page_controller.ex | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/ret_web/controllers/page_controller.ex b/lib/ret_web/controllers/page_controller.ex index 56348d7f9..1cadf0a01 100644 --- a/lib/ret_web/controllers/page_controller.ex +++ b/lib/ret_web/controllers/page_controller.ex @@ -435,7 +435,7 @@ defmodule RetWeb.PageController do hub_meta_tags = Phoenix.View.render_to_string(RetWeb.PageView, "hub-meta.html", - hub: hub |> maybe_scrub_room_name(), + hub: hub |> maybe_scrub_room_data(), scene: hub.scene, ret_meta: Ret.Meta.get_meta(include_repo: false), available_integrations_script: {:safe, available_integrations_script |> with_script_tags}, @@ -793,9 +793,14 @@ defmodule RetWeb.PageController do defp module_config(key), do: Application.get_env(:ret, __MODULE__)[key] - defp maybe_scrub_room_name(hub) do + defp maybe_scrub_room_data(hub) do if hub.entry_mode == :deny do - Map.merge(hub, %{name: "Closed Room"}) + Map.merge(hub, %{name: "Closed Room", + description: "This room is closed.", + slug: "", + scene: nil, + scene_listing: nil, + user_data: nil}) else hub end From 2544c5d1c22017b83717dfe3abd42aedf7452ccb Mon Sep 17 00:00:00 2001 From: John Shaughnessy Date: Tue, 30 Nov 2021 11:35:29 -0500 Subject: [PATCH 3/3] Fix formatting --- lib/ret_web/controllers/page_controller.ex | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/ret_web/controllers/page_controller.ex b/lib/ret_web/controllers/page_controller.ex index 1cadf0a01..ba930e685 100644 --- a/lib/ret_web/controllers/page_controller.ex +++ b/lib/ret_web/controllers/page_controller.ex @@ -795,15 +795,16 @@ defmodule RetWeb.PageController do defp maybe_scrub_room_data(hub) do if hub.entry_mode == :deny do - Map.merge(hub, %{name: "Closed Room", - description: "This room is closed.", - slug: "", - scene: nil, - scene_listing: nil, - user_data: nil}) + Map.merge(hub, %{ + name: "Closed Room", + description: "This room is closed.", + slug: "", + scene: nil, + scene_listing: nil, + user_data: nil + }) else hub end end - end