-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hide room name if the room is closed #535
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM except for the format lint error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made some suggestions. I wonder if we should instead just be returning an error outright.. I guess the main reason we don't is we want the client to render the "room closed" page.
|
||
defp maybe_scrub_room_data(hub) do | ||
if hub.entry_mode == :deny do | ||
Map.merge(hub, %{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might just return a new struct here instead, we could easily add new fields and then forget to "scrub" them later.
@@ -792,4 +792,19 @@ defmodule RetWeb.PageController do | |||
defp with_script_tags(script), do: "<script>#{script}</script>" | |||
|
|||
defp module_config(key), do: Application.get_env(:ret, __MODULE__)[key] | |||
|
|||
defp maybe_scrub_room_data(hub) do | |||
if hub.entry_mode == :deny do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably more idiomatic, not sure if better.. But you could pattern match on the entry_mode instead of using a conditional. As in:
defp maybe_scrub_room_data(%Hub{entry_mode: :deny}) do
@@ -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_data(), | |||
scene: hub.scene, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we were trying to "scrub" the scene we are still returning it here.
No description provided.