diff --git a/pkg/arvo/app/hark-graph-hook.hoon b/pkg/arvo/app/hark-graph-hook.hoon index 1f0bf1d51..9ba152630 100644 --- a/pkg/arvo/app/hark-graph-hook.hoon +++ b/pkg/arvo/app/hark-graph-hook.hoon @@ -12,7 +12,7 @@ :: +$ state-0 $: %0 - watching=(set resource) + watching=(set [resource index:post]) mentions=_& watch-on-self=_& == @@ -83,16 +83,16 @@ %set-watch-on-self (set-watch-on-self +.action) == ++ listen - |= graph=resource + |= [graph=resource =index:post] ^- (quip card _state) - :- (give:ha ~[/updates] [%listen graph]) - state(watching (~(put in watching) graph)) + :- (give:ha ~[/updates] [%listen graph index]) + state(watching (~(put in watching) [graph index])) :: ++ ignore - |= graph=resource + |= [graph=resource =index:post] ^- (quip card _state) - :- (give:ha ~[/updates] [%ignore graph]) - state(watching (~(del in watching) graph)) + :- (give:ha ~[/updates] [%ignore graph index]) + state(watching (~(del in watching) [graph index])) :: ++ set-mentions |= ment=? @@ -127,10 +127,18 @@ (graph-update !<(update:graph-store q.cage.sign)) [cards this] == + ++ add-graph + |= rid=resource + ^- (quip card _state) + ?. &(watch-on-self =(our.bowl entity.rid)) + [~ state] + `state(watching (~(put in watching) [rid ~])) :: ++ graph-update |= =update:graph-store ^- (quip card _state) + ?: ?=(%add-graph -.q.update) + (add-graph resource.q.update) ?. ?=(%add-nodes -.q.update) [~ state] =/ group=resource @@ -187,15 +195,19 @@ (self-post node) :_ state (weld child-cards self-cards) - =+ !<(notif-kind=(unit @t) (tube !>([0 post.node]))) + =+ !< notif-kind=(unit [name=@t parent-lent=@ud]) + (tube !>([0 post.node])) ?~ notif-kind [child-cards state] =/ desc=@t ?: (is-mention contents.post.node) %mention - u.notif-kind + name.u.notif-kind + =/ parent=index:post + (scag parent-lent.u.notif-kind index.post.node) + ~& parent ?. ?| =(desc %mention) - (~(has in watching) rid) + (~(has in watching) [rid parent]) == [child-cards state] =/ notif-index=index:store @@ -222,7 +234,7 @@ ^- (quip card _state) ?. ?=(%.y watch-on-self) [~ state] - `state(watching (~(put in watching) rid)) + `state(watching (~(put in watching) [rid index.post.node])) :: ++ add-unread |= [=index:store =notification:store] diff --git a/pkg/arvo/lib/graph-store.hoon b/pkg/arvo/lib/graph-store.hoon index 98eaa8fc6..0b339bc76 100644 --- a/pkg/arvo/lib/graph-store.hoon +++ b/pkg/arvo/lib/graph-store.hoon @@ -52,6 +52,7 @@ ++ index |= i=^index ^- json + ?: =(~ i) s+'/' =/ j=^tape "" |- ?~ i [%s (crip j)] diff --git a/pkg/arvo/lib/hark/graph-hook.hoon b/pkg/arvo/lib/hark/graph-hook.hoon index 260773340..06e20fcb6 100644 --- a/pkg/arvo/lib/hark/graph-hook.hoon +++ b/pkg/arvo/lib/hark/graph-hook.hoon @@ -1,4 +1,4 @@ -/- sur=hark-graph-hook +/- sur=hark-graph-hook, post /+ graph-store, resource ^? =< [. sur] @@ -9,20 +9,20 @@ =, dejs:format |% :: - ++ graph-indices - %- ot - :~ graph+dejs-path:resource - indices+(as graph-index) - == - :: - ++ graph-index + ++ index ^- $-(json index:graph-store) (su ;~(pfix net (more net dem))) :: + ++ graph-index + %- ot + :~ graph+dejs-path:resource + index+index + == + :: ++ action %- of - :~ listen+dejs-path:resource - ignore+dejs-path:resource + :~ listen+graph-index + ignore+graph-index set-mentions+bo set-watch-on-self+bo == @@ -31,11 +31,11 @@ =, enjs:format |% :: - ++ graph-indices - |= [graph=resource indices=(set index:graph-store)] + ++ graph-index + |= [graph=resource =index:post] %- pairs :~ graph+s+(enjs-path:resource graph) - indices+a+(turn ~(tap in indices) index:enjs:graph-store) + index+(index:enjs:graph-store index) == :: ++ action @@ -45,9 +45,11 @@ ?- -.act %set-watch-on-self b+watch-on-self.act %set-mentions b+mentions.act - ?(%listen %ignore) s+(enjs-path:resource graph.act) + ?(%listen %ignore) (graph-index graph.act index.act) == :: + :: + :: ++ update |= upd=^update ^- json @@ -57,7 +59,8 @@ %- pairs :~ 'watchOnSelf'^b+watch-on-self.upd 'mentions'^b+mentions.upd - watching+a+(turn ~(tap in watching.upd) |=(r=resource s+(enjs-path:resource r))) + :+ %watching %a + (turn ~(tap in watching.upd) graph-index) == -- -- diff --git a/pkg/arvo/mar/graph/validator/link.hoon b/pkg/arvo/mar/graph/validator/link.hoon index 69087ca1c..2daeba3b3 100644 --- a/pkg/arvo/mar/graph/validator/link.hoon +++ b/pkg/arvo/mar/graph/validator/link.hoon @@ -5,8 +5,8 @@ ++ noun i ++ notification-kind ?+ index.p.i ~ - [@ ~] `%link - [@ @ ~] `%comment + [@ ~] `[%link 0] + [@ @ ~] `[%comment 1] == -- ++ grab diff --git a/pkg/arvo/mar/graph/validator/publish.hoon b/pkg/arvo/mar/graph/validator/publish.hoon index 7c06e56f7..c9237b3d9 100644 --- a/pkg/arvo/mar/graph/validator/publish.hoon +++ b/pkg/arvo/mar/graph/validator/publish.hoon @@ -8,8 +8,8 @@ :: ++ notification-kind ?+ index.p.i ~ - [@ %1 @ ~] `%note - [@ %2 @ ~] `%comment + [@ %1 @ ~] `[%note 0] + [@ %2 @ ~] `[%comment 1] == -- ++ grab diff --git a/pkg/arvo/sur/hark-graph-hook.hoon b/pkg/arvo/sur/hark-graph-hook.hoon index bad5e7c9e..ff9edd232 100644 --- a/pkg/arvo/sur/hark-graph-hook.hoon +++ b/pkg/arvo/sur/hark-graph-hook.hoon @@ -1,10 +1,10 @@ -/- *resource, graph-store +/- *resource, graph-store, post ^? |% :: +$ action $% - [?(%listen %ignore) graph=resource] + [?(%listen %ignore) graph=resource =index:post] [%set-mentions mentions=?] [%set-watch-on-self watch-on-self=?] == @@ -13,7 +13,7 @@ $% action $: %initial - watching=(set resource) + watching=(set [resource index:post]) mentions=_& watch-on-self=_& ==