From 9cc2d07a4e32c2137dae932b44093531bd6fb17c Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Tue, 21 Sep 2021 13:34:09 +1000 Subject: [PATCH] dm-hook: notify on pending --- pkg/landscape/app/dm-hook.hoon | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/pkg/landscape/app/dm-hook.hoon b/pkg/landscape/app/dm-hook.hoon index e22c91b428..7c32a29919 100644 --- a/pkg/landscape/app/dm-hook.hoon +++ b/pkg/landscape/app/dm-hook.hoon @@ -1,5 +1,6 @@ :: dm-hook [landscape]: receive and send DMs :: +/- hark=hark-store /+ default-agent, dbug, store=graph-store, graphlib=graph, agentio, resource /+ sig=signatures, hook=dm-hook :: @@ -202,11 +203,12 @@ ?> =(1 ~(wyt by nodes)) =/ ship-screen (~(get ju screened) src.bowl) =. ship-screen (~(uni in ship-screen) (normalize-incoming nodes)) - =. screened (~(put by screened) src.bowl ship-screen) - :_ state + :_ state(screened (~(put by screened) src.bowl ship-screen)) =/ =action:hook [%pendings ~(key by screened)] - (fact:io dm-hook-action+!>(action) ~[/updates])^~ + :- (fact:io dm-hook-action+!>(action) ~[/updates]) + ?: (~(has by screened) src.bowl) ~ + (notify-pending src.bowl)^~ :: ++ dm-exists |= =ship @@ -265,6 +267,16 @@ == == :: + ++ notify-pending + |= =ship + ^- card + =/ =bin:hark [/ [q.byk.bowl /dm/invite]] + =/ title=(list content:hark) + [ship/ship text/' invited you to a DM' ~] + %+ poke-our:pass %hark-store + :- %hark-action + !>(`action:hark`[%add-note bin title ~ now.bowl / /dm/(scot %p ship)]) + :: ++ normalize-incoming |= =nodes ^- ^nodes @@ -301,7 +313,13 @@ (fact-init:io dm-hook-action+!>([%screen screening])) == :: -++ on-peek on-peek:def +++ on-peek + |= =path + ^- (unit (unit cage)) + ?+ path (on-peek:def path) + [%x %pendings ~] ``dm-hook-action+!>([%pendings ~(key by screened)]) + == +:: ++ on-leave on-leave:def ++ on-agent |= [=wire =sign:agent:gall]