Skip to content

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.

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

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.

4 participants