mirror of
https://github.com/urbit/shrub.git
synced 2024-12-26 21:44:11 +03:00
chat-hook: hack to move scry to a new event to fix +on-load
This commit is contained in:
parent
65bb8a0fb5
commit
2f9a7c9c68
@ -93,68 +93,15 @@
|
|||||||
[cards this(state old)]
|
[cards this(state old)]
|
||||||
?: ?=(%9 -.old)
|
?: ?=(%9 -.old)
|
||||||
=. cards
|
=. cards
|
||||||
%+ weld cards
|
:_ cards
|
||||||
^- (list card)
|
[%pass /self-poke %agent [our.bol %chat-hook] %poke %noun !>(%run-upg9)]
|
||||||
%+ roll ~(tap in ~(key by wex.bol))
|
$(-.old %10)
|
||||||
|= [[=wire =ship =term] out=(list card)]
|
|
||||||
?> ?=([@ *] wire)
|
|
||||||
?. ?&(=(ship our.bol) =(term %chat-hook))
|
|
||||||
out
|
|
||||||
:_ out
|
|
||||||
=- [%pass / %agent [our.bol %chat-hook] %poke %chat-hook-action !>(-)]
|
|
||||||
[%remove t.wire]
|
|
||||||
=/ chat-keys=(set path) (scry-for (set path) %chat-store [%keys ~])
|
|
||||||
=. cards
|
|
||||||
%+ weld cards
|
|
||||||
^- (list card)
|
|
||||||
%+ turn ~(tap in chat-keys)
|
|
||||||
|= =app=path
|
|
||||||
^- card
|
|
||||||
?> ?=([@ @ ~] app-path)
|
|
||||||
=/ =ship (slav %p i.app-path)
|
|
||||||
?: =(ship our.bol)
|
|
||||||
(add-owned app-path %.y)
|
|
||||||
(add-synced ship app-path)
|
|
||||||
::
|
|
||||||
=/ list-paths=(list path)
|
|
||||||
%+ murn ~(tap in ~(key by synced.old))
|
|
||||||
|= =app=path
|
|
||||||
^- (unit path)
|
|
||||||
?~ (groups-of-chat:cc app-path)
|
|
||||||
`app-path
|
|
||||||
~
|
|
||||||
|-
|
|
||||||
?~ list-paths
|
|
||||||
^$(-.old %10)
|
|
||||||
=. synced.old (~(del by synced.old) i.list-paths)
|
|
||||||
$(list-paths t.list-paths)
|
|
||||||
?: ?=(%8 -.old)
|
?: ?=(%8 -.old)
|
||||||
$(-.old %9)
|
$(-.old %9)
|
||||||
?: ?=(%7 -.old)
|
?: ?=(%7 -.old)
|
||||||
=/ subscribers=(jug path ship)
|
|
||||||
%+ roll ~(val by sup.bol)
|
|
||||||
|= [[=ship =path] out=(jug path ship)]
|
|
||||||
:: /(mailbox|backlog)/~ship/resource.name
|
|
||||||
::
|
|
||||||
?. ?=([@ @ @ *] path) out
|
|
||||||
=/ pax=^path [i.t.path i.t.t.path ~]
|
|
||||||
(~(put ju out) pax ship)
|
|
||||||
=/ group ~(. grpl bol)
|
|
||||||
=. cards
|
=. cards
|
||||||
%+ weld cards
|
:_ cards
|
||||||
^- (list card)
|
[%pass /self-poke %agent [our.bol %chat-hook] %poke %noun !>(%run-upg7)]
|
||||||
%+ murn ~(tap in ~(key by synced.old))
|
|
||||||
|= =path
|
|
||||||
^- (unit card)
|
|
||||||
?> ?=([@ @ ~] path)
|
|
||||||
=/ group-paths (groups-of-chat:cc path)
|
|
||||||
?~ group-paths ~
|
|
||||||
=/ members (members-from-path:group i.group-paths)
|
|
||||||
?: (is-managed-path:group i.group-paths) ~
|
|
||||||
=/ ships=(set ship) (~(get ju subscribers) path)
|
|
||||||
%- some
|
|
||||||
=+ [%invite path (~(dif in members) ships)]
|
|
||||||
[%pass /inv %agent [our.bol %chat-view] %poke %chat-view-action !>(-)]
|
|
||||||
$(-.old %8)
|
$(-.old %8)
|
||||||
?: ?=(%6 -.old)
|
?: ?=(%6 -.old)
|
||||||
=. cards
|
=. cards
|
||||||
@ -417,7 +364,8 @@
|
|||||||
?+ mark (on-poke:def mark vase)
|
?+ mark (on-poke:def mark vase)
|
||||||
%json (poke-json:cc !<(json vase))
|
%json (poke-json:cc !<(json vase))
|
||||||
%chat-action (poke-chat-action:cc !<(action:store vase))
|
%chat-action (poke-chat-action:cc !<(action:store vase))
|
||||||
%noun (poke-noun:cc !<(?(%fix-dm %fix-out-of-sync) vase))
|
%noun
|
||||||
|
(poke-noun:cc !<(?(%fix-dm %fix-out-of-sync %run-upg7 %run-upg9) vase))
|
||||||
::
|
::
|
||||||
%chat-hook-action
|
%chat-hook-action
|
||||||
(poke-chat-hook-action:cc !<(action:hook vase))
|
(poke-chat-hook-action:cc !<(action:hook vase))
|
||||||
@ -480,15 +428,100 @@
|
|||||||
++ grp ~(. grpl bol)
|
++ grp ~(. grpl bol)
|
||||||
::
|
::
|
||||||
++ poke-noun
|
++ poke-noun
|
||||||
|= a=?(%fix-dm %fix-out-of-sync)
|
|= a=?(%fix-dm %fix-out-of-sync %run-upg7 %run-upg9)
|
||||||
^- (quip card _state)
|
^- (quip card _state)
|
||||||
|^
|
|^
|
||||||
:_ state
|
|
||||||
?- a
|
?- a
|
||||||
%fix-dm (fix-dm %fix-dm)
|
%fix-dm [(fix-dm %fix-dm) state]
|
||||||
%fix-out-of-sync (fix-out-of-sync %fix-out-of-sync)
|
%fix-out-of-sync [(fix-out-of-sync %fix-out-of-sync) state]
|
||||||
|
%run-upg7 run-7-to-8
|
||||||
|
%run-upg9 run-9-to-10
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
|
++ scry-for
|
||||||
|
|* [=mold app=term =path]
|
||||||
|
.^ mold
|
||||||
|
%gx
|
||||||
|
(scot %p our.bol)
|
||||||
|
app
|
||||||
|
(scot %da now.bol)
|
||||||
|
(snoc `^path`path %noun)
|
||||||
|
==
|
||||||
|
::
|
||||||
|
++ add-synced
|
||||||
|
|= [=ship =path]
|
||||||
|
^- card
|
||||||
|
=- [%pass / %agent [our.bol %chat-hook] %poke %chat-hook-action -]
|
||||||
|
!>(`action:hook`[%add-synced ship path %.y])
|
||||||
|
::
|
||||||
|
++ add-owned
|
||||||
|
|= [=path history=?]
|
||||||
|
^- card
|
||||||
|
=- [%pass / %agent [our.bol %chat-hook] %poke %chat-hook-action -]
|
||||||
|
!>(`action:hook`[%add-owned path history])
|
||||||
|
::
|
||||||
|
++ run-7-to-8
|
||||||
|
^- (quip card _state)
|
||||||
|
:_ state
|
||||||
|
=/ subscribers=(jug path ship)
|
||||||
|
%+ roll ~(val by sup.bol)
|
||||||
|
|= [[=ship =path] out=(jug path ship)]
|
||||||
|
:: /(mailbox|backlog)/~ship/resource.name
|
||||||
|
::
|
||||||
|
?. ?=([@ @ @ *] path) out
|
||||||
|
=/ pax=^path [i.t.path i.t.t.path ~]
|
||||||
|
(~(put ju out) pax ship)
|
||||||
|
=/ group ~(. grpl bol)
|
||||||
|
^- (list card)
|
||||||
|
%+ murn ~(tap in ~(key by synced.state))
|
||||||
|
|= =path
|
||||||
|
^- (unit card)
|
||||||
|
?> ?=([@ @ ~] path)
|
||||||
|
=/ group-paths (groups-of-chat path)
|
||||||
|
?~ group-paths ~
|
||||||
|
=/ members (members-from-path:group i.group-paths)
|
||||||
|
?: (is-managed-path:group i.group-paths) ~
|
||||||
|
=/ ships=(set ship) (~(get ju subscribers) path)
|
||||||
|
%- some
|
||||||
|
=+ [%invite path (~(dif in members) ships)]
|
||||||
|
[%pass /inv %agent [our.bol %chat-view] %poke %chat-view-action !>(-)]
|
||||||
|
::
|
||||||
|
++ run-9-to-10
|
||||||
|
^- (quip card _state)
|
||||||
|
:_
|
||||||
|
=/ list-paths=(list path)
|
||||||
|
%+ murn ~(tap in ~(key by synced.state))
|
||||||
|
|= =app=path
|
||||||
|
^- (unit path)
|
||||||
|
?~ (groups-of-chat app-path)
|
||||||
|
`app-path
|
||||||
|
~
|
||||||
|
|-
|
||||||
|
?~ list-paths
|
||||||
|
state
|
||||||
|
=. synced.state (~(del by synced.state) i.list-paths)
|
||||||
|
$(list-paths t.list-paths)
|
||||||
|
%+ weld
|
||||||
|
^- (list card)
|
||||||
|
%+ roll ~(tap in ~(key by wex.bol))
|
||||||
|
|= [[=wire =ship =term] out=(list card)]
|
||||||
|
?> ?=([@ *] wire)
|
||||||
|
?. ?&(=(ship our.bol) =(term %chat-hook))
|
||||||
|
out
|
||||||
|
:_ out
|
||||||
|
=- [%pass / %agent [our.bol %chat-hook] %poke %chat-hook-action !>(-)]
|
||||||
|
[%remove t.wire]
|
||||||
|
=/ chat-keys=(set path) (scry-for (set path) %chat-store [%keys ~])
|
||||||
|
^- (list card)
|
||||||
|
%+ turn ~(tap in chat-keys)
|
||||||
|
|= =app=path
|
||||||
|
^- card
|
||||||
|
?> ?=([@ @ ~] app-path)
|
||||||
|
=/ =ship (slav %p i.app-path)
|
||||||
|
?: =(ship our.bol)
|
||||||
|
(add-owned app-path %.y)
|
||||||
|
(add-synced ship app-path)
|
||||||
|
::
|
||||||
++ fix-out-of-sync
|
++ fix-out-of-sync
|
||||||
|= b=%fix-out-of-sync
|
|= b=%fix-out-of-sync
|
||||||
^- (list card)
|
^- (list card)
|
||||||
|
Loading…
Reference in New Issue
Block a user