From cf4f0f302eb69a6a93e9fa7f851e5fb2076e70ad Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Wed, 28 Oct 2020 15:52:59 +1000 Subject: [PATCH] hark: final pass for bugs --- pkg/arvo/app/hark-graph-hook.hoon | 8 ++++---- pkg/arvo/app/hark-store.hoon | 21 ++++++++++++++------- pkg/arvo/lib/hark/graph-hook.hoon | 4 ---- pkg/arvo/lib/hark/store.hoon | 10 ++++++++++ pkg/arvo/mar/hark/group-hook-update.hoon | 2 +- pkg/arvo/sur/hark-store.hoon | 1 + 6 files changed, 30 insertions(+), 16 deletions(-) diff --git a/pkg/arvo/app/hark-graph-hook.hoon b/pkg/arvo/app/hark-graph-hook.hoon index df8ad0a9b..ba73cb137 100644 --- a/pkg/arvo/app/hark-graph-hook.hoon +++ b/pkg/arvo/app/hark-graph-hook.hoon @@ -144,9 +144,7 @@ (need (peek-metadata:met %graph group resource.q.update)) =* rid resource.q.update =+ (scry ,mark=(unit mark) /gx/graph-store/graph-mark/(scot %p entity.rid)/[name.rid]/noun) - ?~ mark - [~ state] - =+ (scry ,=tube:clay /cc/[q.byk.bowl]/[u.mark]/notification-kind) + =+ (scry ,=tube:clay /cc/[q.byk.bowl]/[(fall mark %graph-validator-link)]/notification-kind) ^- (quip card _state) =/ nodes=(list [p=index:graph-store q=node:graph-store]) ~(tap by nodes.q.update) @@ -189,7 +187,9 @@ ?~ contents %.n ?. ?=(%text -.i.contents) $(contents t.contents) - ?^ (find (trip text.i.contents) (scow %p our.bowl)) + =/ res + (find (scow %p our.bowl) (trip text.i.contents)) + ?^ res %.y $(contents t.contents) :: diff --git a/pkg/arvo/app/hark-store.hoon b/pkg/arvo/app/hark-store.hoon index 1ebdc2a5e..8378456c4 100644 --- a/pkg/arvo/app/hark-store.hoon +++ b/pkg/arvo/app/hark-store.hoon @@ -147,8 +147,11 @@ (merge-notification:ha u.existing-notif notification) =/ new-timebox=timebox:store (~(put by timebox) index new) - :- ~ :: (give:ha [/updates]~ %add index notification) - state(notifications (put:orm notifications last-seen new-timebox)) + :- (give:ha [/updates]~ %added last-seen index new) + %_ state + notifications (put:orm notifications last-seen new-timebox) + unread-count +(unread-count) + == :: ++ do-archive |= [time=@da =index:store] @@ -161,6 +164,7 @@ (~(del by timebox) index) :- (give:ha [/updates]~ %archive time index) %_ state + unread-count (dec unread-count) :: notifications (put:orm notifications time new-timebox) @@ -176,13 +180,19 @@ |= [time=@da =index:store] ^- (quip card _state) :- (give:ha [/updates]~ %read time index) - state(notifications (change-read-status:ha time index %.y)) + %_ state + unread-count (dec unread-count) + notifications (change-read-status:ha time index %.y) + == :: ++ unread |= [time=@da =index:store] ^- (quip card _state) :- (give:ha [/updates]~ %unread time index) - state(notifications (change-read-status:ha time index %.n)) + %_ state + unread-count +(unread-count) + notifications (change-read-status:ha time index %.n) + == :: ++ seen ^- (quip card _state) @@ -233,9 +243,6 @@ :: ++ change-read-status |= [time=@da =index:store read=?] - ~& `@ud`time - ~& index - ~& ;;((list @ud) (key-orm notifications)) ^+ notifications %^ jub-orm notifications time |= =timebox:store diff --git a/pkg/arvo/lib/hark/graph-hook.hoon b/pkg/arvo/lib/hark/graph-hook.hoon index cd5a28c55..260773340 100644 --- a/pkg/arvo/lib/hark/graph-hook.hoon +++ b/pkg/arvo/lib/hark/graph-hook.hoon @@ -23,8 +23,6 @@ %- of :~ listen+dejs-path:resource ignore+dejs-path:resource - listen-indices+graph-indices - ignore-indices+graph-indices set-mentions+bo set-watch-on-self+bo == @@ -48,7 +46,6 @@ %set-watch-on-self b+watch-on-self.act %set-mentions b+mentions.act ?(%listen %ignore) s+(enjs-path:resource graph.act) - ?(%listen-indices %ignore-indices) (graph-indices +.act) == :: ++ update @@ -61,7 +58,6 @@ :~ 'watchOnSelf'^b+watch-on-self.upd 'mentions'^b+mentions.upd watching+a+(turn ~(tap in watching.upd) |=(r=resource s+(enjs-path:resource r))) - 'watchingIndices'^a+(turn ~(tap by watching-indices.upd) graph-indices) == -- -- diff --git a/pkg/arvo/lib/hark/store.hoon b/pkg/arvo/lib/hark/store.hoon index 757f83a85..9fd359da6 100644 --- a/pkg/arvo/lib/hark/store.hoon +++ b/pkg/arvo/lib/hark/store.hoon @@ -68,6 +68,7 @@ |^ %+ frond -.upd ?+ -.upd a+~ + %added (added +.upd) %timebox (timebox +.upd) %set-dnd b+dnd.upd %count (numb count.upd) @@ -76,6 +77,15 @@ (notif-ref +.upd) == :: + ++ added + |= [tim=@da idx=^index not=^notification] + ^- json + %- pairs + :~ time+s+(scot %ud tim) + index+(index idx) + notification+(notification not) + == + :: ++ notif-ref |= [tim=@da idx=^index] ^- json diff --git a/pkg/arvo/mar/hark/group-hook-update.hoon b/pkg/arvo/mar/hark/group-hook-update.hoon index a788413ae..95063a5a0 100644 --- a/pkg/arvo/mar/hark/group-hook-update.hoon +++ b/pkg/arvo/mar/hark/group-hook-update.hoon @@ -6,7 +6,7 @@ ++ noun upd ++ json %+ frond:enjs:format - %hark-graph-hook-update + %hark-group-hook-update (update:enjs upd) -- ++ grab diff --git a/pkg/arvo/sur/hark-store.hoon b/pkg/arvo/sur/hark-store.hoon index aca529e73..d95ab1f1e 100644 --- a/pkg/arvo/sur/hark-store.hoon +++ b/pkg/arvo/sur/hark-store.hoon @@ -42,6 +42,7 @@ +$ update $% action [%more =(list update)] + [%added time=@da =index =notification] [%timebox time=@da archived=? =(list [index notification])] [%count count=@ud] ==