hark: address L review

This commit is contained in:
Liam Fitzgerald 2020-11-10 13:32:48 +10:00
parent 5eb1aa4327
commit 7e5bf37184
No known key found for this signature in database
GPG Key ID: D390E12C61D1CFFB
14 changed files with 63 additions and 83 deletions

View File

@ -21,7 +21,18 @@
=| state-0
=* state -
::
=<
=>
|_ =bowl:gall
::
++ give
|= [paths=(list path) =update:hook]
^- (list card)
[%give %fact paths hark-chat-hook-update+!>(update)]~
::
++ watch-chat
^- card
[%pass /chat %agent [our.bowl %chat-store] %watch /updates]
--
%- agent:dbug
^- agent:gall
~% %hark-chat-hook-agent ..card ~
@ -73,6 +84,7 @@
|= =action:hook
^- (quip card _state)
|^
:- (give:ha ~[/updates] action)
?- -.action
%listen (listen +.action)
%ignore (ignore +.action)
@ -80,20 +92,17 @@
==
++ listen
|= chat=path
^- (quip card _state)
:- (give:ha ~[/updates] [%listen chat])
^+ state
state(watching (~(put in watching) chat))
::
++ ignore
|= chat=path
^- (quip card _state)
:- (give:ha ~[/updates] [%ignore chat])
^+ state
state(watching (~(del in watching) chat))
::
++ set-mentions
|= ment=?
^- (quip card _state)
:- (give:ha ~[/updates] [%set-mentions ment])
^+ state
state(mentions ment)
--
--
@ -130,7 +139,7 @@
(turn envelopes.update (cury process-envelope path.update))
==
++ is-mention
|= [=path =envelope:chat-store]
|= =envelope:chat-store
?. ?=(%text -.letter.envelope) %.n
?& mentions
?= ^
@ -147,7 +156,7 @@
|= [=path =envelope:chat-store]
^- (list card)
=/ mention=?
(is-mention path envelope)
(is-mention envelope)
?. ?|(mention (is-notification path envelope))
~
=/ =index:store
@ -159,9 +168,8 @@
++ poke-store
|= =action:store
^- card
=/ =cage
hark-action+!>(action)
[%pass /store %agent [our.bowl %hark-store] %poke cage]
=- [%pass /store %agent [our.bowl %hark-store] %poke -]
hark-action+!>(action)
--
::
++ on-peek on-peek:def
@ -170,15 +178,3 @@
++ on-arvo on-arvo:def
++ on-fail on-fail:def
--
|_ =bowl:gall
::
::
++ give
|= [paths=(list path) =update:hook]
^- (list card)
[%give %fact paths hark-chat-hook-update+!>(update)]~
::
++ watch-chat
^- card
[%pass /chat %agent [our.bowl %chat-store] %watch /updates]
--

View File

@ -22,7 +22,24 @@
=| state-0
=* state -
::
=<
=>
|_ =bowl:gall
::
++ scry
|* [=mold p=path]
?> ?=(^ p)
?> ?=(^ t.p)
.^(mold i.p (scot %p our.bowl) i.t.p (scot %da now.bowl) t.t.p)
::
++ give
|= [paths=(list path) =update:hook]
^- (list card)
[%give %fact paths hark-graph-hook-update+!>(update)]~
::
++ watch-graph
^- card
[%pass /graph %agent [our.bowl %graph-store] %watch /updates]
--
%- agent:dbug
^- agent:gall
~% %hark-graph-hook-agent ..card ~
@ -76,6 +93,7 @@
|= =action:hook
^- (quip card _state)
|^
:- (give:ha ~[/updates] action)
?- -.action
%listen (listen +.action)
%ignore (ignore +.action)
@ -84,26 +102,22 @@
==
++ listen
|= graph=resource
^- (quip card _state)
:- (give:ha ~[/updates] [%listen graph])
^+ state
state(watching (~(put in watching) graph))
::
++ ignore
|= graph=resource
^- (quip card _state)
:- (give:ha ~[/updates] [%ignore graph])
^+ state
state(watching (~(del in watching) graph))
::
++ set-mentions
|= ment=?
^- (quip card _state)
:- (give:ha ~[/updates] %set-mentions ment)
^+ state
state(mentions ment)
::
++ set-watch-on-self
|= self=?
^- (quip card _state)
:- (give:ha ~[/updates] %set-watch-on-self self)
^+ state
state(watch-on-self self)
--
--
@ -239,20 +253,4 @@
++ on-arvo on-arvo:def
++ on-fail on-fail:def
--
|_ =bowl:gall
::
++ scry
|* [=mold p=path]
?> ?=(^ p)
?> ?=(^ t.p)
.^(mold i.p (scot %p our.bowl) i.t.p (scot %da now.bowl) t.t.p)
::
++ give
|= [paths=(list path) =update:hook]
^- (list card)
[%give %fact paths hark-graph-hook-update+!>(update)]~
::
++ watch-graph
^- card
[%pass /graph %agent [our.bowl %graph-store] %watch /updates]
--

View File

@ -27,7 +27,6 @@
$: unread-count=@ud
~
==
::
++ orm ((ordered-map @da timebox:store) lth)
--
@ -67,6 +66,7 @@
:_ this
[%give %fact ~ hark-update+!>(initial-updates)]~
==
::
++ initial-updates
^- update:store
:- %more
@ -113,8 +113,8 @@
^- update:store
:^ %timebox time %.n
~(tap by timebox)
::
==
::
++ on-poke
~/ %hark-store-poke
|= [=mark =vase]
@ -211,7 +211,6 @@
^- (quip card _state)
:_ state(dnd d)
(give:ha [/updates]~ %set-dnd d)
::
--
--
::

View File

@ -2,7 +2,7 @@
/+ drum=hood-drum, helm=hood-helm, kiln=hood-kiln
|%
+$ state
$: %10
$: %11
drum=state:drum
helm=state:helm
kiln=state:kiln
@ -13,6 +13,7 @@
[%7 drum=state:drum helm=state:helm kiln=state:kiln]
[%8 drum=state:drum helm=state:helm kiln=state:kiln]
[%9 drum=state:drum helm=state:helm kiln=state:kiln]
[%10 drum=state:drum helm=state:helm kiln=state:kiln]
==
+$ any-state-tuple
$: drum=any-state:drum

View File

@ -3,11 +3,9 @@
=< [. sur]
=, sur
|%
::
++ dejs
=, dejs:format
|%
::
++ action
%- of
:~ listen+pa
@ -19,7 +17,6 @@
++ enjs
=, enjs:format
|%
::
++ update
|= upd=^update
%+ frond -.upd

View File

@ -4,11 +4,9 @@
=< [. sur]
=, sur
|%
::
++ dejs
=, dejs:format
|%
::
++ graph-indices
%- ot
:~ graph+dejs-path:resource
@ -27,10 +25,10 @@
set-watch-on-self+bo
==
--
::
++ enjs
=, enjs:format
|%
::
++ graph-indices
|= [graph=resource indices=(set index:graph-store)]
%- pairs

View File

@ -4,11 +4,9 @@
=< [. sur]
=, sur
|%
::
++ dejs
=, dejs:format
|%
::
++ action
%- of
:~ listen+dejs-path:resource
@ -19,18 +17,18 @@
++ enjs
=, enjs:format
|%
::
++ res
(cork enjs-path:resource (lead %s))
::
++ update
|= upd=^update
%+ frond -.upd
?- -.upd
?(%listen %ignore) (res group.upd)
::
%initial
:- %a
(turn ~(tap in watching.upd) res)
::
?(%listen %ignore) (res group.upd)
==
--
--

View File

@ -68,7 +68,6 @@
++ enjs
=, enjs:format
|%
::
++ update
|= upd=^update
^- json
@ -80,6 +79,7 @@
%set-dnd b+dnd.upd
%count (numb count.upd)
%more (more +.upd)
::
?(%archive %read %unread)
(notif-ref +.upd)
==
@ -210,11 +210,3 @@
--
--
--

View File

@ -107,6 +107,10 @@
%graph-store
%graph-pull-hook
%graph-push-hook
%hark-store
%hark-graph-hook
%hark-group-hook
%hark-chat-hook
==
::
++ deft-fish :: default connects
@ -209,7 +213,7 @@
==
::
++ on-load
|= [hood-version=?(%1 %2 %3 %4 %5 %6 %7 %8 %9 %10) old=any-state]
|= [hood-version=@ud old=any-state]
=< se-abet =< se-view
=. sat old
=. dev (~(gut by bin) ost *source)
@ -241,6 +245,11 @@
=? ..on-load (lte hood-version %10)
=> (se-born | %home %graph-push-hook)
(se-born | %home %graph-pull-hook)
=? ..on-load (lte hood-version %11)
=> (se-born | %home %hark-graph-hook)
=> (se-born | %home %hark-group-hook)
=> (se-born | %home %hark-chat-hook)
(se-born | %home %hark-store)
..on-load
::
++ reap-phat :: ack connect

View File

@ -1,6 +1,5 @@
^?
|%
::
+$ action
$% [?(%listen %ignore) chat=path]
[%set-mentions mentions=?]

View File

@ -1,7 +1,6 @@
/- *resource, graph-store
^?
|%
::
+$ action
$%
[?(%listen %ignore) graph=resource]
@ -19,4 +18,3 @@
==
==
--

View File

@ -1,7 +1,6 @@
/- *resource
^?
|%
::
+$ action
[?(%listen %ignore) group=resource]
::
@ -9,6 +8,4 @@
$% action
[%initial watching=(set resource)]
==
::
--

View File

@ -1,7 +1,6 @@
/- *resource, graph-store, post, group-store, metadata-store, chat-store
^?
|%
::
+$ index
$% [%graph group=resource graph=resource module=@t description=@t]
[%group group=resource description=@t]

View File

@ -22,7 +22,6 @@
;< ~ bind:m
(poke-our %group-push-hook %push-hook-action !>([%add rid]))
(pure:m rid)
::
--
::
=, strand=strand:spider