aboutsummaryrefslogtreecommitdiff
path: root/shardweb/lib/views/layout_view.ex
diff options
context:
space:
mode:
Diffstat (limited to 'shardweb/lib/views/layout_view.ex')
-rw-r--r--shardweb/lib/views/layout_view.ex7
1 files changed, 5 insertions, 2 deletions
diff --git a/shardweb/lib/views/layout_view.ex b/shardweb/lib/views/layout_view.ex
index d554804..40863a1 100644
--- a/shardweb/lib/views/layout_view.ex
+++ b/shardweb/lib/views/layout_view.ex
@@ -3,6 +3,7 @@ defmodule ShardWeb.LayoutView do
def shard_list do
Shard.Manager.list_shards
+ |> Enum.map(fn {id, manifest, _} -> {id, manifest, Shard.Manager.find_or_start manifest} end)
end
def str_of_pk_list(conn, pk_list) do
@@ -32,7 +33,8 @@ defmodule ShardWeb.LayoutView do
end
def privchat_with_unread(conn) do
- for {id, %SApp.Chat.PrivChat.Manifest{pk_list: pk_list}, pid} <- shard_list(),
+ for {id, %SApp.Chat.PrivChat.Manifest{pk_list: pk_list}, _} <- shard_list(),
+ pid = Shard.Manager.find_or_start(%SApp.Chat.PrivChat.Manifest{pk_list: pk_list}),
conn.assigns.pk in pk_list,
unread_time = SApp.Chat.has_unread?(pid),
unread_time != nil,
@@ -40,7 +42,8 @@ defmodule ShardWeb.LayoutView do
end
def chat_with_unread(_conn) do
- for {id, %SApp.Chat.Manifest{channel: c}, pid} <- shard_list(),
+ for {id, %SApp.Chat.Manifest{channel: c}, _} <- shard_list(),
+ pid = Shard.Manager.find_or_start(%SApp.Chat.Manifest{channel: c}),
unread_time = SApp.Chat.has_unread?(pid),
unread_time != nil,
do: {id, %SApp.Chat.Manifest{channel: c}, pid}