Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

johnshaughnessy
Copy link
Contributor

No description provided.

Copy link
Contributor

@brianpeiris brianpeiris left a 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

Copy link
Contributor

@netpro2k netpro2k left a 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, %{
Copy link
Contributor

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
Copy link
Contributor

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,
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants