2020-10-21 09:02:51 +03:00
|
|
|
:: hark-graph-hook: notifications for graph-store [landscape]
|
|
|
|
::
|
2021-01-28 09:13:57 +03:00
|
|
|
/- post, group-store, metadata=metadata-store, hook=hark-graph-hook, store=hark-store
|
2021-09-10 06:45:43 +03:00
|
|
|
/- hist=hark-store-historical
|
2021-09-06 06:31:11 +03:00
|
|
|
/+ resource, mdl=metadata, default-agent, dbug, graph-store, graph, grouplib=group
|
2021-09-10 06:45:43 +03:00
|
|
|
/+ agentio
|
2020-10-21 09:02:51 +03:00
|
|
|
::
|
2020-11-24 05:20:44 +03:00
|
|
|
::
|
2020-12-05 07:32:17 +03:00
|
|
|
~% %hark-graph-hook-top ..part ~
|
2020-10-21 09:02:51 +03:00
|
|
|
|%
|
|
|
|
+$ card card:agent:gall
|
|
|
|
+$ versioned-state
|
|
|
|
$% state-0
|
2021-01-14 03:47:11 +03:00
|
|
|
state-1
|
2020-10-21 09:02:51 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
+$ state-0
|
2021-01-14 03:47:11 +03:00
|
|
|
[%0 base-state-0]
|
|
|
|
::
|
|
|
|
+$ state-1
|
|
|
|
[%1 base-state-0]
|
|
|
|
::
|
2021-09-06 06:31:11 +03:00
|
|
|
+$ state-2
|
|
|
|
[%2 base-state-1]
|
|
|
|
::
|
2021-01-14 03:47:11 +03:00
|
|
|
+$ base-state-0
|
|
|
|
$: watching=(set [resource index:post])
|
2020-10-27 08:05:00 +03:00
|
|
|
mentions=_&
|
|
|
|
watch-on-self=_&
|
2020-10-21 09:02:51 +03:00
|
|
|
==
|
|
|
|
::
|
2021-09-06 06:31:11 +03:00
|
|
|
+$ base-state-1
|
|
|
|
$: watching=(set [resource index:post])
|
|
|
|
mentions=_&
|
|
|
|
watch-on-self=_&
|
|
|
|
places=(map resource place:store)
|
|
|
|
==
|
|
|
|
::
|
2020-12-14 06:14:56 +03:00
|
|
|
++ scry
|
|
|
|
|* [[our=@p now=@da] =mold p=path]
|
|
|
|
?> ?=(^ p)
|
2021-09-06 06:31:11 +03:00
|
|
|
~! p
|
2020-12-14 06:14:56 +03:00
|
|
|
?> ?=(^ t.p)
|
|
|
|
.^(mold i.p (scot %p our) i.t.p (scot %da now) t.t.p)
|
|
|
|
::
|
2021-06-10 21:13:38 +03:00
|
|
|
++ scry-notif-conversion
|
2020-12-14 06:14:56 +03:00
|
|
|
|= [[our=@p now=@da] desk=term =mark]
|
2021-09-06 06:31:11 +03:00
|
|
|
^- $-(indexed-post:graph-store $-(cord (unit notif-kind:hook)))
|
2020-12-14 06:14:56 +03:00
|
|
|
%^ scry [our now]
|
2021-09-06 06:31:11 +03:00
|
|
|
$-(indexed-post:graph-store $-(cord (unit notif-kind:hook)))
|
2021-06-10 21:13:38 +03:00
|
|
|
/cf/[desk]/[mark]/notification-kind
|
2020-10-21 09:02:51 +03:00
|
|
|
--
|
|
|
|
::
|
2021-01-14 03:47:11 +03:00
|
|
|
=| state-1
|
2020-10-21 09:02:51 +03:00
|
|
|
=* state -
|
|
|
|
::
|
2020-12-14 06:14:56 +03:00
|
|
|
=<
|
2020-10-21 09:02:51 +03:00
|
|
|
%- agent:dbug
|
|
|
|
^- agent:gall
|
|
|
|
~% %hark-graph-hook-agent ..card ~
|
|
|
|
|_ =bowl:gall
|
|
|
|
+* this .
|
|
|
|
ha ~(. +> bowl)
|
|
|
|
def ~(. (default-agent this %|) bowl)
|
2021-01-28 09:13:57 +03:00
|
|
|
met ~(. mdl bowl)
|
2020-12-07 06:55:55 +03:00
|
|
|
grp ~(. grouplib bowl)
|
2020-12-01 08:46:28 +03:00
|
|
|
gra ~(. graph bowl)
|
2021-09-10 06:45:43 +03:00
|
|
|
io ~(. agentio bowl)
|
|
|
|
pass pass:io
|
2020-10-21 09:02:51 +03:00
|
|
|
::
|
|
|
|
++ on-init
|
|
|
|
:_ this
|
|
|
|
~[watch-graph:ha]
|
|
|
|
::
|
|
|
|
++ on-save !>(state)
|
|
|
|
++ on-load
|
2021-01-14 03:47:11 +03:00
|
|
|
|= =vase
|
2020-10-21 09:02:51 +03:00
|
|
|
^- (quip card _this)
|
2021-01-14 03:47:11 +03:00
|
|
|
=+ !<(old=versioned-state vase)
|
|
|
|
=| cards=(list card)
|
2021-09-06 06:31:11 +03:00
|
|
|
=. cards [watch-graph:ha cards]
|
2021-01-14 03:47:11 +03:00
|
|
|
|-
|
|
|
|
?: ?=(%0 -.old)
|
|
|
|
%_ $
|
|
|
|
-.old %1
|
|
|
|
::
|
|
|
|
cards
|
|
|
|
:_ cards
|
|
|
|
[%pass / %agent [our dap]:bowl %poke noun+!>(%rewatch-dms)]
|
|
|
|
==
|
|
|
|
:_ this(state old)
|
|
|
|
=. cards (flop cards)
|
2021-06-15 19:31:25 +03:00
|
|
|
?: (~(has by wex.bowl) [/graph our.bowl %graph-store])
|
|
|
|
cards
|
|
|
|
[watch-graph:ha cards]
|
2020-10-21 09:02:51 +03:00
|
|
|
::
|
2020-11-10 22:21:51 +03:00
|
|
|
++ on-watch
|
2020-10-27 08:05:00 +03:00
|
|
|
|= =path
|
|
|
|
^- (quip card _this)
|
|
|
|
=^ cards state
|
2020-11-03 03:36:00 +03:00
|
|
|
?+ path (on-watch:def path)
|
|
|
|
::
|
2020-11-10 22:21:51 +03:00
|
|
|
[%updates ~]
|
2020-11-03 03:36:00 +03:00
|
|
|
:_ state
|
|
|
|
%+ give:ha ~
|
|
|
|
:* %initial
|
|
|
|
watching
|
|
|
|
mentions
|
|
|
|
watch-on-self
|
|
|
|
==
|
2020-10-27 08:05:00 +03:00
|
|
|
==
|
|
|
|
[cards this]
|
2020-10-21 09:02:51 +03:00
|
|
|
::
|
|
|
|
++ on-poke
|
|
|
|
~/ %hark-graph-hook-poke
|
|
|
|
|= [=mark =vase]
|
|
|
|
^- (quip card _this)
|
|
|
|
|^
|
|
|
|
?> (team:title our.bowl src.bowl)
|
|
|
|
=^ cards state
|
|
|
|
?+ mark (on-poke:def mark vase)
|
2021-09-10 06:45:43 +03:00
|
|
|
%hark-graph-migrate
|
|
|
|
=+ !<(old=versioned-state:hist vase)
|
|
|
|
?. ?=(%7 -.old) ~|(%old-hark-dropping !!)
|
|
|
|
(hark-graph-migrate old)
|
|
|
|
::
|
2020-10-21 09:02:51 +03:00
|
|
|
%hark-graph-hook-action
|
|
|
|
(hark-graph-hook-action !<(action:hook vase))
|
2021-09-10 06:45:43 +03:00
|
|
|
::
|
2021-01-14 03:47:11 +03:00
|
|
|
%noun
|
|
|
|
(poke-noun !<(* vase))
|
2020-10-21 09:02:51 +03:00
|
|
|
==
|
|
|
|
[cards this]
|
|
|
|
::
|
2021-09-10 06:45:43 +03:00
|
|
|
++ hark-graph-migrate
|
|
|
|
|= old=state-7:hist
|
|
|
|
=| cards=(list card)
|
|
|
|
|^
|
|
|
|
[(flop get-places) state]
|
|
|
|
::
|
|
|
|
++ hark
|
|
|
|
|= =action:store
|
|
|
|
[(poke-our:pass %hark-store hark-action+!>(action)) cards]
|
|
|
|
::
|
|
|
|
++ get-places
|
|
|
|
^- (list card)
|
|
|
|
=/ stats-indices=(set stats-index:hist)
|
|
|
|
(~(uni in ~(key by last-seen.old)) ~(key by unreads-count.old))
|
|
|
|
%- zing
|
|
|
|
(turn ~(tap in stats-indices) get-stats)
|
|
|
|
::
|
|
|
|
++ get-stats
|
|
|
|
|= =stats-index:hist
|
|
|
|
^- (list card)
|
|
|
|
=/ place=(unit place:store)
|
|
|
|
(stats-index-to-place stats-index)
|
|
|
|
?~ place ~
|
|
|
|
=/ count (~(get by unreads-count.old) stats-index)
|
|
|
|
=? cards ?=(^ count)
|
|
|
|
(hark %unread-count u.place & u.count)
|
|
|
|
=/ last (~(get by last-seen.old) stats-index)
|
|
|
|
=? cards ?=(^ last)
|
2021-09-17 03:48:38 +03:00
|
|
|
(hark %saw-place u.place `u.last)
|
2021-09-10 06:45:43 +03:00
|
|
|
cards
|
|
|
|
::
|
|
|
|
++ stats-index-to-place
|
|
|
|
|= =stats-index:hist
|
|
|
|
^- (unit place:store)
|
|
|
|
?. ?=(%graph -.stats-index) ~
|
|
|
|
`(get-place [graph index]:stats-index)
|
|
|
|
--
|
|
|
|
::
|
2021-01-14 03:47:11 +03:00
|
|
|
++ poke-noun
|
|
|
|
|= non=*
|
2021-05-01 03:55:27 +03:00
|
|
|
[~ state]
|
|
|
|
:: ?> ?=(%rewatch-dms non)
|
|
|
|
:: =/ graphs=(list resource)
|
|
|
|
:: ~(tap in get-keys:gra)
|
|
|
|
:: %_ state
|
|
|
|
:: watching
|
|
|
|
:: %- ~(gas in watching)
|
|
|
|
:: (murn graphs |=(rid=resource ?:((should-watch:ha rid) `[rid ~] ~)))
|
|
|
|
:: ==
|
2021-01-14 03:47:11 +03:00
|
|
|
::
|
2020-10-21 09:02:51 +03:00
|
|
|
++ hark-graph-hook-action
|
|
|
|
|= =action:hook
|
|
|
|
^- (quip card _state)
|
|
|
|
|^
|
2020-11-10 06:32:48 +03:00
|
|
|
:- (give:ha ~[/updates] action)
|
2020-10-21 09:02:51 +03:00
|
|
|
?- -.action
|
|
|
|
%listen (listen +.action)
|
|
|
|
%ignore (ignore +.action)
|
2020-10-27 08:05:00 +03:00
|
|
|
%set-mentions (set-mentions +.action)
|
|
|
|
%set-watch-on-self (set-watch-on-self +.action)
|
2020-10-21 09:02:51 +03:00
|
|
|
==
|
|
|
|
++ listen
|
2020-11-10 04:41:19 +03:00
|
|
|
|= [graph=resource =index:post]
|
2020-11-11 03:36:32 +03:00
|
|
|
^+ state
|
2020-11-10 04:41:19 +03:00
|
|
|
state(watching (~(put in watching) [graph index]))
|
2020-10-21 09:02:51 +03:00
|
|
|
::
|
|
|
|
++ ignore
|
2020-11-10 04:41:19 +03:00
|
|
|
|= [graph=resource =index:post]
|
2020-11-11 03:36:32 +03:00
|
|
|
^+ state
|
2020-11-10 04:41:19 +03:00
|
|
|
state(watching (~(del in watching) [graph index]))
|
2020-10-21 09:02:51 +03:00
|
|
|
::
|
2020-10-27 08:05:00 +03:00
|
|
|
++ set-mentions
|
|
|
|
|= ment=?
|
2020-11-10 06:32:48 +03:00
|
|
|
^+ state
|
2020-10-27 08:05:00 +03:00
|
|
|
state(mentions ment)
|
|
|
|
::
|
|
|
|
++ set-watch-on-self
|
|
|
|
|= self=?
|
2020-11-10 06:32:48 +03:00
|
|
|
^+ state
|
2020-10-27 08:05:00 +03:00
|
|
|
state(watch-on-self self)
|
2020-10-21 09:02:51 +03:00
|
|
|
--
|
|
|
|
--
|
|
|
|
::
|
|
|
|
++ on-agent
|
|
|
|
~/ %hark-graph-hook-agent
|
|
|
|
|= [=wire =sign:agent:gall]
|
|
|
|
^- (quip card _this)
|
|
|
|
|^
|
|
|
|
?+ -.sign (on-agent:def wire sign)
|
|
|
|
%kick
|
|
|
|
:_ this
|
|
|
|
?. ?=([%graph ~] wire)
|
|
|
|
~
|
|
|
|
~[watch-graph:ha]
|
|
|
|
::
|
|
|
|
%fact
|
2021-04-14 23:49:54 +03:00
|
|
|
?. ?=(%graph-update-2 p.cage.sign)
|
2020-10-21 09:02:51 +03:00
|
|
|
(on-agent:def wire sign)
|
|
|
|
=^ cards state
|
|
|
|
(graph-update !<(update:graph-store q.cage.sign))
|
|
|
|
[cards this]
|
|
|
|
==
|
2020-12-17 09:10:26 +03:00
|
|
|
::
|
|
|
|
++ graph-update
|
|
|
|
|= =update:graph-store
|
|
|
|
^- (quip card _state)
|
|
|
|
?+ -.q.update `state
|
|
|
|
%add-graph (add-graph resource.q.update)
|
|
|
|
::
|
|
|
|
?(%remove-graph %archive-graph)
|
|
|
|
(remove-graph resource.q.update)
|
2021-05-01 03:55:27 +03:00
|
|
|
::
|
2021-04-14 00:30:35 +03:00
|
|
|
%remove-posts
|
|
|
|
(remove-posts resource.q.update indices.q.update)
|
2021-05-01 03:55:27 +03:00
|
|
|
::
|
2020-12-17 09:10:26 +03:00
|
|
|
%add-nodes
|
|
|
|
=* rid resource.q.update
|
2021-05-01 03:55:27 +03:00
|
|
|
=/ assoc=(unit association:metadata)
|
|
|
|
(peek-association:met %graph rid)
|
|
|
|
(check-nodes ~(val by nodes.q.update) rid assoc)
|
2020-12-17 09:10:26 +03:00
|
|
|
==
|
2021-01-11 04:55:33 +03:00
|
|
|
:: this is awful, but notification kind should always switch
|
|
|
|
:: on the index, so hopefully doesn't matter
|
|
|
|
:: TODO: rethink this
|
2021-04-14 00:30:35 +03:00
|
|
|
++ remove-posts
|
2021-01-11 04:55:33 +03:00
|
|
|
|= [rid=resource indices=(set index:graph-store)]
|
|
|
|
=/ to-remove
|
|
|
|
%- ~(gas by *(set [resource index:graph-store]))
|
|
|
|
(turn ~(tap in indices) (lead rid))
|
|
|
|
:_ state(watching (~(dif in watching) to-remove))
|
2021-09-06 06:31:11 +03:00
|
|
|
=/ convert (get-conversion:ha rid '')
|
2021-01-11 04:55:33 +03:00
|
|
|
%+ roll
|
|
|
|
~(tap in indices)
|
|
|
|
|= [=index:graph-store out=(list card)]
|
|
|
|
=| =indexed-post:graph-store
|
|
|
|
=. index.p.indexed-post index
|
2021-06-10 21:13:38 +03:00
|
|
|
=/ notif-kind=(unit notif-kind:hook)
|
|
|
|
(convert indexed-post)
|
|
|
|
?~ notif-kind out
|
2021-09-06 06:31:11 +03:00
|
|
|
=/ =place:store
|
|
|
|
(get-place rid index)
|
2021-06-10 21:13:38 +03:00
|
|
|
?. ?=(%each mode.u.notif-kind) out
|
2021-01-12 01:15:14 +03:00
|
|
|
:_ out
|
2021-09-06 06:31:11 +03:00
|
|
|
(poke-hark %read-each place index)
|
2021-01-11 04:55:33 +03:00
|
|
|
::
|
|
|
|
++ poke-hark
|
|
|
|
|= =action:store
|
|
|
|
^- card
|
|
|
|
[%pass / %agent [our.bowl %hark-store] %poke hark-action+!>(action)]
|
2020-12-17 09:10:26 +03:00
|
|
|
::
|
|
|
|
++ remove-graph
|
|
|
|
|= rid=resource
|
|
|
|
=/ unwatched
|
2021-01-11 07:16:32 +03:00
|
|
|
%- ~(gas in *(set [resource index:graph-store]))
|
2020-12-17 09:10:26 +03:00
|
|
|
%+ skim ~(tap in watching)
|
|
|
|
|= [r=resource idx=index:graph-store]
|
|
|
|
=(r rid)
|
|
|
|
:_ state(watching (~(dif in watching) unwatched))
|
|
|
|
^- (list card)
|
2021-09-06 06:31:11 +03:00
|
|
|
~
|
|
|
|
:: XX: fix
|
2020-12-17 09:10:26 +03:00
|
|
|
::
|
2020-11-10 04:41:19 +03:00
|
|
|
++ add-graph
|
2020-12-17 04:59:35 +03:00
|
|
|
|= rid=resource
|
2020-11-10 04:41:19 +03:00
|
|
|
^- (quip card _state)
|
2020-12-17 04:59:35 +03:00
|
|
|
=/ graph=graph:graph-store :: graph in subscription is bunted
|
|
|
|
(get-graph-mop:gra rid)
|
|
|
|
=/ node=(unit node:graph-store)
|
2021-04-29 00:12:46 +03:00
|
|
|
(bind (pry:orm:graph-store graph) |=([@ =node:graph-store] node))
|
2021-05-01 03:55:27 +03:00
|
|
|
=/ assoc=(unit association:metadata)
|
|
|
|
(peek-association:met %graph rid)
|
2020-12-17 04:59:35 +03:00
|
|
|
=^ cards state
|
2021-05-01 03:55:27 +03:00
|
|
|
(check-nodes (drop node) rid assoc)
|
|
|
|
?. (should-watch:ha rid assoc)
|
2021-01-14 03:47:11 +03:00
|
|
|
[cards state]
|
2020-12-17 04:59:35 +03:00
|
|
|
:_ state(watching (~(put in watching) [rid ~]))
|
|
|
|
(weld cards (give:ha ~[/updates] %listen [rid ~]))
|
2020-10-21 09:02:51 +03:00
|
|
|
::
|
2020-12-01 08:46:28 +03:00
|
|
|
++ check-nodes
|
2020-12-14 06:14:56 +03:00
|
|
|
|= $: nodes=(list node:graph-store)
|
2020-12-01 08:46:28 +03:00
|
|
|
rid=resource
|
2021-05-01 03:55:27 +03:00
|
|
|
assoc=(unit association:metadata)
|
2020-12-01 08:46:28 +03:00
|
|
|
==
|
2021-04-28 07:57:53 +03:00
|
|
|
abet:check:(abed:handle-update:ha rid nodes)
|
2020-10-21 09:02:51 +03:00
|
|
|
--
|
|
|
|
::
|
|
|
|
++ on-peek on-peek:def
|
|
|
|
::
|
|
|
|
++ on-leave on-leave:def
|
2020-12-01 08:46:28 +03:00
|
|
|
++ on-arvo
|
|
|
|
|= [=wire =sign-arvo]
|
|
|
|
^- (quip card _this)
|
|
|
|
?+ wire (on-arvo:def wire sign-arvo)
|
|
|
|
::
|
2021-06-15 19:31:25 +03:00
|
|
|
:: no longer necessary
|
|
|
|
[%validator @ ~] [~ this]
|
2020-12-01 08:46:28 +03:00
|
|
|
==
|
2020-10-21 09:02:51 +03:00
|
|
|
++ on-fail on-fail:def
|
|
|
|
--
|
2020-12-14 06:14:56 +03:00
|
|
|
::
|
|
|
|
|_ =bowl:gall
|
2021-01-28 09:13:57 +03:00
|
|
|
+* met ~(. mdl bowl)
|
2021-01-14 03:47:11 +03:00
|
|
|
grp ~(. grouplib bowl)
|
|
|
|
gra ~(. graph bowl)
|
2020-12-14 06:14:56 +03:00
|
|
|
::
|
2021-09-06 06:31:11 +03:00
|
|
|
++ graph-index-to-path
|
|
|
|
|= =index:graph-store
|
|
|
|
^- path
|
|
|
|
(turn index (cork (cury scot %ui) (cury rsh 4)))
|
|
|
|
::
|
|
|
|
++ summarize
|
|
|
|
|= contents=(list content:post)
|
|
|
|
%+ rap 3
|
|
|
|
%+ join ' '
|
|
|
|
%+ turn contents
|
|
|
|
|= =content:post
|
|
|
|
?- -.content
|
|
|
|
%text text.content
|
|
|
|
%url url.content
|
|
|
|
%code '<Code fragment>'
|
|
|
|
%reference '<A reference>'
|
|
|
|
%mention (scot %p ship.content)
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ get-place
|
|
|
|
|= [rid=resource =index:graph-store]
|
|
|
|
:- q.byk.bowl
|
|
|
|
(welp /graph/(scot %p entity.rid)/[name.rid] (graph-index-to-path index))
|
|
|
|
::
|
|
|
|
++ get-bin
|
|
|
|
|= [rid=resource parent=index:graph-store is-mention=?]
|
2021-09-17 03:48:38 +03:00
|
|
|
^- bin:store
|
2021-09-06 06:31:11 +03:00
|
|
|
[?:(is-mention /mention /) (get-place rid parent)]
|
|
|
|
::
|
2021-01-11 04:55:33 +03:00
|
|
|
++ get-conversion
|
2021-09-06 06:31:11 +03:00
|
|
|
|= [rid=resource title=cord]
|
2021-06-10 21:13:38 +03:00
|
|
|
^- $-(indexed-post:graph-store (unit notif-kind:hook))
|
2021-01-11 04:55:33 +03:00
|
|
|
=+ %^ scry [our now]:bowl
|
|
|
|
,mark=(unit mark)
|
2021-07-07 22:17:07 +03:00
|
|
|
/gx/graph-store/graph/(scot %p entity.rid)/[name.rid]/mark/noun
|
2021-01-11 04:55:33 +03:00
|
|
|
?~ mark
|
2021-06-10 21:13:38 +03:00
|
|
|
|=(=indexed-post:graph-store ~)
|
2021-09-06 06:31:11 +03:00
|
|
|
=/ f=$-(indexed-post:graph-store $-(cord (unit notif-kind:hook)))
|
|
|
|
(scry-notif-conversion [our now]:bowl q.byk.bowl u.mark)
|
|
|
|
|= =indexed-post:graph-store
|
|
|
|
((f indexed-post) title)
|
2020-12-14 06:14:56 +03:00
|
|
|
::
|
|
|
|
++ 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]
|
|
|
|
::
|
|
|
|
++ poke-hark
|
|
|
|
|= =action:store
|
|
|
|
^- card
|
|
|
|
=- [%pass / %agent [our.bowl %hark-store] %poke -]
|
|
|
|
hark-action+!>(action)
|
|
|
|
::
|
|
|
|
++ is-mention
|
|
|
|
|= contents=(list content:post)
|
|
|
|
^- ?
|
|
|
|
?. mentions %.n
|
|
|
|
?~ contents %.n
|
|
|
|
?. ?=(%mention -.i.contents)
|
|
|
|
$(contents t.contents)
|
|
|
|
?: =(our.bowl ship.i.contents)
|
|
|
|
%.y
|
|
|
|
$(contents t.contents)
|
|
|
|
::
|
2021-01-14 03:47:11 +03:00
|
|
|
++ should-watch
|
2021-05-01 03:55:27 +03:00
|
|
|
|= [rid=resource assoc=(unit association:metadata)]
|
2021-01-14 03:47:11 +03:00
|
|
|
^- ?
|
2021-05-01 03:55:27 +03:00
|
|
|
?~ assoc
|
2021-05-17 05:01:59 +03:00
|
|
|
%.y
|
|
|
|
&(watch-on-self =(our.bowl entity.rid))
|
2021-01-14 03:47:11 +03:00
|
|
|
::
|
2020-12-14 06:14:56 +03:00
|
|
|
++ handle-update
|
|
|
|
|_ $: rid=resource :: input
|
|
|
|
updates=(list node:graph-store)
|
2021-04-28 07:57:53 +03:00
|
|
|
mark=(unit mark)
|
2020-12-14 06:14:56 +03:00
|
|
|
hark-pokes=(list action:store) :: output
|
|
|
|
new-watches=(list index:graph-store)
|
|
|
|
==
|
|
|
|
++ update-core .
|
|
|
|
::
|
|
|
|
++ abed
|
2021-04-28 07:57:53 +03:00
|
|
|
|= [r=resource upds=(list node:graph-store)]
|
|
|
|
=/ m=(unit ^mark)
|
|
|
|
(get-mark:gra r)
|
|
|
|
update-core(rid r, updates upds, mark m)
|
2020-12-14 06:14:56 +03:00
|
|
|
::
|
2021-09-06 06:31:11 +03:00
|
|
|
++ title
|
|
|
|
~+ title:(fall (peek-metadatum:met %graph rid) *metadatum:metadata)
|
|
|
|
::
|
2020-12-14 06:14:56 +03:00
|
|
|
++ get-conversion
|
2021-09-06 06:31:11 +03:00
|
|
|
~+ (^get-conversion rid title)
|
2020-12-14 06:14:56 +03:00
|
|
|
::
|
|
|
|
++ abet
|
|
|
|
^- (quip card _state)
|
|
|
|
:_ state(watching (~(uni in watching) (silt (turn new-watches (lead rid)))))
|
|
|
|
^- (list card)
|
|
|
|
%+ welp (turn (flop hark-pokes) poke-hark)
|
|
|
|
%- zing
|
|
|
|
%+ turn (flop new-watches)
|
|
|
|
|=(=index:graph-store (give ~[/updates] [%listen rid index]))
|
|
|
|
::
|
|
|
|
++ hark
|
|
|
|
|= =action:store
|
|
|
|
^+ update-core
|
|
|
|
update-core(hark-pokes [action hark-pokes])
|
|
|
|
::
|
|
|
|
++ new-watch
|
2021-02-26 06:36:15 +03:00
|
|
|
|= [=index:graph-store =watch-for:hook =index-len:hook]
|
|
|
|
=? new-watches =(%siblings watch-for)
|
|
|
|
[(scag parent.index-len index) new-watches]
|
|
|
|
=? new-watches =(%children watch-for)
|
|
|
|
[(scag self.index-len index) new-watches]
|
|
|
|
update-core
|
2020-12-14 06:14:56 +03:00
|
|
|
::
|
|
|
|
++ check
|
|
|
|
|- ^+ update-core
|
|
|
|
?~ updates
|
|
|
|
update-core
|
|
|
|
=/ core=_update-core
|
|
|
|
(check-node i.updates)
|
|
|
|
=. updates.core t.updates
|
|
|
|
$(update-core core)
|
|
|
|
::
|
|
|
|
++ check-node-children
|
|
|
|
|= =node:graph-store
|
|
|
|
^+ update-core
|
|
|
|
?: ?=(%empty -.children.node)
|
|
|
|
update-core
|
|
|
|
=/ children=(list [=atom =node:graph-store])
|
|
|
|
(tap:orm:graph-store p.children.node)
|
|
|
|
|- ^+ update-core
|
|
|
|
?~ children
|
|
|
|
update-core
|
|
|
|
=. update-core (check-node node.i.children)
|
|
|
|
$(children t.children)
|
|
|
|
::
|
|
|
|
++ check-node
|
|
|
|
|= =node:graph-store
|
|
|
|
^+ update-core
|
|
|
|
=. update-core (check-node-children node)
|
2021-04-14 00:30:35 +03:00
|
|
|
?: ?=(%| -.post.node)
|
|
|
|
update-core
|
2021-09-06 06:31:11 +03:00
|
|
|
::?~ mark update-core
|
2021-04-14 00:30:35 +03:00
|
|
|
=* pos p.post.node
|
2021-06-10 21:13:38 +03:00
|
|
|
=/ notif-kind=(unit notif-kind:hook)
|
2021-09-06 06:31:11 +03:00
|
|
|
(get-conversion [0 pos])
|
2020-12-14 06:14:56 +03:00
|
|
|
?~ notif-kind
|
|
|
|
update-core
|
|
|
|
=* not-kind u.notif-kind
|
|
|
|
=/ parent=index:post
|
2021-04-14 00:30:35 +03:00
|
|
|
(scag parent.index-len.not-kind index.pos)
|
2021-09-06 06:31:11 +03:00
|
|
|
=/ is-mention (is-mention contents.pos)
|
|
|
|
=/ =bin:store
|
|
|
|
(get-bin rid parent is-mention)
|
2021-04-14 00:30:35 +03:00
|
|
|
?: =(our.bowl author.pos)
|
2021-09-06 06:31:11 +03:00
|
|
|
(self-post node bin u.notif-kind)
|
2020-12-14 06:14:56 +03:00
|
|
|
=. update-core
|
2021-09-06 06:31:11 +03:00
|
|
|
%^ update-unread-count u.notif-kind bin
|
|
|
|
(scag self.index-len.not-kind index.pos)
|
2020-12-14 06:14:56 +03:00
|
|
|
=? update-core
|
2021-09-06 06:31:11 +03:00
|
|
|
?| is-mention
|
2020-12-14 06:14:56 +03:00
|
|
|
(~(has in watching) [rid parent])
|
2021-04-28 07:57:53 +03:00
|
|
|
=(mark `%graph-validator-dm)
|
2020-12-14 06:33:31 +03:00
|
|
|
==
|
2021-09-06 06:31:11 +03:00
|
|
|
=/ link=path
|
|
|
|
(welp /(fall mark '')/(scot %p entity.rid)/[name.rid] (graph-index-to-path index.pos))
|
2021-09-17 03:48:38 +03:00
|
|
|
=/ title=(list content:store)
|
|
|
|
?. is-mention title.not-kind
|
|
|
|
~[text/(rap 3 'You were mentioned in ' title ~)]
|
2021-09-06 06:31:11 +03:00
|
|
|
=/ =body:store
|
2021-09-17 03:48:38 +03:00
|
|
|
[title body.not-kind now.bowl path.bin link]
|
2021-09-06 06:31:11 +03:00
|
|
|
(add-unread bin body)
|
2020-12-14 06:14:56 +03:00
|
|
|
update-core
|
|
|
|
::
|
2021-09-06 06:31:11 +03:00
|
|
|
::
|
2020-12-14 06:14:56 +03:00
|
|
|
++ update-unread-count
|
2021-09-06 06:31:11 +03:00
|
|
|
|= [=notif-kind:hook =bin:store =index:graph-store]
|
2020-12-16 07:22:23 +03:00
|
|
|
?- mode.notif-kind
|
2021-09-06 06:31:11 +03:00
|
|
|
%count (hark %unread-count place.bin %.y 1)
|
|
|
|
%each (hark %unread-each place.bin /(rsh 4 (scot %ui (rear index))))
|
2020-12-14 06:14:56 +03:00
|
|
|
%none update-core
|
|
|
|
==
|
|
|
|
::
|
2021-09-17 03:48:38 +03:00
|
|
|
::
|
2020-12-14 06:14:56 +03:00
|
|
|
++ self-post
|
|
|
|
|= $: =node:graph-store
|
2021-09-06 06:31:11 +03:00
|
|
|
=bin:store
|
2021-02-26 06:36:15 +03:00
|
|
|
=notif-kind:hook
|
2020-12-14 06:14:56 +03:00
|
|
|
==
|
|
|
|
^+ update-core
|
2021-04-14 00:30:35 +03:00
|
|
|
?> ?=(%& -.post.node)
|
2020-12-14 06:33:31 +03:00
|
|
|
=. update-core
|
2021-09-17 03:48:38 +03:00
|
|
|
(hark %saw-place place.bin `now.bowl)
|
2021-02-26 06:36:15 +03:00
|
|
|
=? update-core ?=(%count mode.notif-kind)
|
2021-09-06 06:31:11 +03:00
|
|
|
(hark %read-count place.bin)
|
2021-02-26 06:36:15 +03:00
|
|
|
=? update-core watch-on-self
|
2021-04-14 00:30:35 +03:00
|
|
|
(new-watch index.p.post.node [watch-for index-len]:notif-kind)
|
2020-12-14 06:14:56 +03:00
|
|
|
update-core
|
|
|
|
::
|
|
|
|
++ add-unread
|
2021-09-06 06:31:11 +03:00
|
|
|
|= [=bin:store =body:store]
|
|
|
|
(hark %add-note bin body)
|
2020-12-14 06:14:56 +03:00
|
|
|
--
|
|
|
|
--
|