aboutsummaryrefslogtreecommitdiff
path: root/shardweb/lib/views/layout_view.ex
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2018-10-12 15:52:42 +0200
committerAlex Auvolat <alex@adnab.me>2018-10-12 15:52:42 +0200
commit0d358f6f699a5ce04ffe1bccf4f375b5f321391c (patch)
treeb90a1093b3ac0cd1e7d3643abb34e87078b6072e /shardweb/lib/views/layout_view.ex
parent1e91dc596fd2f7fdd96b7fd2fc50724f93e46529 (diff)
downloadshard-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.ex20
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