diff options
author | Alex Auvolat <alex@adnab.me> | 2018-10-12 16:38:11 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2018-10-12 16:38:11 +0200 |
commit | f5b4131160520a2540445619188c3c8e0f37da37 (patch) | |
tree | b966fbbe827a004caa65a87dfb8672754ce022ab /shardweb/lib/views | |
parent | 0d358f6f699a5ce04ffe1bccf4f375b5f321391c (diff) | |
download | shard-f5b4131160520a2540445619188c3c8e0f37da37.tar.gz shard-f5b4131160520a2540445619188c3c8e0f37da37.zip |
Notifications for chat ; useless user info page
Diffstat (limited to 'shardweb/lib/views')
-rw-r--r-- | shardweb/lib/views/layout_view.ex | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/shardweb/lib/views/layout_view.ex b/shardweb/lib/views/layout_view.ex index 317d405..990df55 100644 --- a/shardweb/lib/views/layout_view.ex +++ b/shardweb/lib/views/layout_view.ex @@ -24,4 +24,25 @@ defmodule ShardWeb.LayoutView do l -> Enum.join(l, ", ") end end + + def chat_shard_last_msg(pid) do + [{{_, msgbin, _}, true}] = GenServer.call(pid, {:read_history, nil, 1}) + {_, msg} = SData.term_unbin msgbin + msg + end + + def privchat_with_unread(conn) do + for {id, %SApp.Chat.PrivChat.Manifest{pk_list: pk_list}, pid} <- shard_list(), + conn.assigns.pk in pk_list, + unread_time = GenServer.call(pid, :has_unread), + unread_time != nil, + do: {id, %SApp.Chat.PrivChat.Manifest{pk_list: pk_list}, pid} + end + + def chat_with_unread(conn) do + for {id, %SApp.Chat.Manifest{channel: c}, pid} <- shard_list(), + unread_time = GenServer.call(pid, :has_unread), + unread_time != nil, + do: {id, %SApp.Chat.Manifest{channel: c}, pid} + end end |