hark: final pass for bugs

This commit is contained in:
Liam Fitzgerald 2020-10-28 15:52:59 +10:00
parent d89ccffb62
commit cf4f0f302e
6 changed files with 30 additions and 16 deletions

View File

@ -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)
::

View File

@ -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

View File

@ -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)
==
--
--

View File

@ -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

View File

@ -6,7 +6,7 @@
++ noun upd
++ json
%+ frond:enjs:format
%hark-graph-hook-update
%hark-group-hook-update
(update:enjs upd)
--
++ grab

View File

@ -42,6 +42,7 @@
+$ update
$% action
[%more =(list update)]
[%added time=@da =index =notification]
[%timebox time=@da archived=? =(list [index notification])]
[%count count=@ud]
==