diff options
author | Alex Auvolat <alex@adnab.me> | 2018-09-26 15:26:06 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2018-09-26 15:26:06 +0200 |
commit | 7d0009d83c9b5c747d4adb535817924762429f30 (patch) | |
tree | 59b368cf189fc10976337e8caf4e6b623d69a04b /shardweb/lib/shard_web/controllers/room_controller.ex | |
parent | f16973d3a492ae6d4890c40d77b0a93d3293bf3a (diff) | |
download | shard-7d0009d83c9b5c747d4adb535817924762429f30.tar.gz shard-7d0009d83c9b5c747d4adb535817924762429f30.zip |
Make it work, including Web interface
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 |