diff options
author | Alex Auvolat <alex@adnab.me> | 2018-10-12 15:52:42 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2018-10-12 15:52:42 +0200 |
commit | 0d358f6f699a5ce04ffe1bccf4f375b5f321391c (patch) | |
tree | b90a1093b3ac0cd1e7d3643abb34e87078b6072e /shardweb/lib/views/layout_view.ex | |
parent | 1e91dc596fd2f7fdd96b7fd2fc50724f93e46529 (diff) | |
download | shard-0d358f6f699a5ce04ffe1bccf4f375b5f321391c.tar.gz shard-0d358f6f699a5ce04ffe1bccf4f375b5f321391c.zip |
Private chat interface
Diffstat (limited to 'shardweb/lib/views/layout_view.ex')
-rw-r--r-- | shardweb/lib/views/layout_view.ex | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/shardweb/lib/views/layout_view.ex b/shardweb/lib/views/layout_view.ex index 2b12323..317d405 100644 --- a/shardweb/lib/views/layout_view.ex +++ b/shardweb/lib/views/layout_view.ex @@ -4,4 +4,24 @@ defmodule ShardWeb.LayoutView do def shard_list do Shard.Manager.list_shards end + + def str_of_pk_list(conn, pk_list) do + case pk_list + |> Enum.filter(&(&1 != conn.assigns.pk)) + |> Enum.map(&Base.encode16/1) + do + [] -> conn.assigns.pk |> Base.encode16 + l -> Enum.join(l, ",") + end + end + + def nicks_of_pk_list(conn, pk_list) do + case pk_list + |> Enum.filter(&(&1 != conn.assigns.pk)) + |> Enum.map(&SApp.Identity.get_nick/1) + do + [] -> "(myself)" + l -> Enum.join(l, ", ") + end + end end |