From 7d0009d83c9b5c747d4adb535817924762429f30 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Wed, 26 Sep 2018 15:26:06 +0200 Subject: Make it work, including Web interface --- shardweb/lib/shard_web/controllers/room_controller.ex | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'shardweb/lib/shard_web/controllers') 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 -- cgit v1.2.3