diff options
Diffstat (limited to 'shardweb/lib/shard_web/controllers/room_controller.ex')
-rw-r--r-- | shardweb/lib/shard_web/controllers/room_controller.ex | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/shardweb/lib/shard_web/controllers/room_controller.ex b/shardweb/lib/shard_web/controllers/room_controller.ex index 4d9adb4..48ba2a4 100644 --- a/shardweb/lib/shard_web/controllers/room_controller.ex +++ b/shardweb/lib/shard_web/controllers/room_controller.ex @@ -1,12 +1,25 @@ defmodule ShardWeb.RoomController do use ShardWeb, :controller + require Logger import PhoenixGon.Controller def show(conn, %{"room" => room}) do + {pk, conn} = case get_session(conn, :pk) do + nil -> + pk = Shard.Keys.get_any_identity + conn = put_session(conn, :pk, pk) + {pk, conn} + x -> + {x, conn} + end + + name = SApp.Identity.get_nick pk + conn = put_gon(conn, chat_room: room) render conn, "show.html", room: room, - name: Shard.Identity.get_nickname + pk: pk, + name: name end end |