mirror of
https://github.com/urbit/shrub.git
synced 2024-11-28 22:33:06 +03:00
chat-hook: recreate all foreign dms as local dms
This commit is contained in:
parent
c96705e755
commit
d737cb28ae
@ -18,17 +18,13 @@
|
||||
state-1
|
||||
state-2
|
||||
state-3
|
||||
state-4
|
||||
==
|
||||
::
|
||||
+$ state-3
|
||||
$: %3
|
||||
state-base
|
||||
==
|
||||
+$ state-4 [%4 state-base]
|
||||
+$ state-3 [%3 state-base]
|
||||
+$ state-2 [%2 state-base]
|
||||
::
|
||||
+$ state-2
|
||||
$: %2
|
||||
state-base
|
||||
==
|
||||
+$ state-1
|
||||
$: %1
|
||||
loaded-cards=*
|
||||
@ -52,7 +48,7 @@
|
||||
$% [%chat-update update:store]
|
||||
==
|
||||
--
|
||||
=| state-3
|
||||
=| state-4
|
||||
=* state -
|
||||
::
|
||||
%- agent:dbug
|
||||
@ -81,8 +77,14 @@
|
||||
=/ old !<(versioned-state old-vase)
|
||||
=| cards=(list card)
|
||||
|-
|
||||
?: ?=(%3 -.old)
|
||||
?: ?=(%4 -.old)
|
||||
[cards this(state old)]
|
||||
?: ?=(%3 -.old)
|
||||
=. cards
|
||||
%+ weld cards
|
||||
^- (list card)
|
||||
[%pass /pokeme %agent [our.bol %chat-hook] %poke %noun !>(%fix-dm)]~
|
||||
$(-.old %4)
|
||||
?: ?=(%2 -.old)
|
||||
=. cards
|
||||
%+ weld cards
|
||||
@ -319,9 +321,9 @@
|
||||
^- (quip card _this)
|
||||
=^ cards state
|
||||
?+ mark (on-poke:def mark vase)
|
||||
%json (poke-json:cc !<(json vase))
|
||||
%chat-action (poke-chat-action:cc !<(action:store vase))
|
||||
%noun [~ state]
|
||||
%json (poke-json:cc !<(json vase))
|
||||
%chat-action (poke-chat-action:cc !<(action:store vase))
|
||||
%noun (poke-fix-dms:cc %fix-dms)
|
||||
::
|
||||
%chat-hook-action
|
||||
(poke-chat-hook-action:cc !<(action:hook vase))
|
||||
@ -383,6 +385,49 @@
|
||||
|_ bol=bowl:gall
|
||||
++ grp ~(. grpl bol)
|
||||
::
|
||||
++ poke-fix-dms
|
||||
|= a=%fix-dms
|
||||
^- (quip card _state)
|
||||
:_ state
|
||||
%- zing
|
||||
%+ turn
|
||||
~(tap by synced)
|
||||
|= [=path host=ship]
|
||||
^- (list card)
|
||||
?> ?=([@ @ *] path)
|
||||
?. =('~' i.path)
|
||||
~
|
||||
:: is local dm
|
||||
?: =((slav %p i.t.path) our.bol)
|
||||
~
|
||||
:: is foreign dm
|
||||
:- =- [%pass /fixdm %agent [our.bol %chat-view] %poke %chat-view-action -]
|
||||
!>
|
||||
^- action:store
|
||||
[%delete path]
|
||||
=/ mailbox=(unit mailbox:store) (chat-scry path)
|
||||
?~ mailbox
|
||||
~
|
||||
:~ =- [%pass /fixdm %agent [our.bol %chat-view] %poke %chat-view-action -]
|
||||
!>
|
||||
^- action:view
|
||||
:* %create
|
||||
(crip "<(scot %p our.bol)> <-> [i.t.path]")
|
||||
''
|
||||
/ship/(scot %p our.bol)/(crip (weld "dm--" (trip i.t.path)))
|
||||
/ship/(scot %p our.bol)/(crip (weld "dm--" (trip i.t.path)))
|
||||
[%invite (silt ~[(slav %p i.t.path)])]
|
||||
(silt ~[(slav %p i.t.path)])
|
||||
%.y
|
||||
%.n
|
||||
==
|
||||
::
|
||||
=- [%pass /fixdm %agent [our.bol %chat-store] %poke %chat-action -]
|
||||
!>
|
||||
^- action:store
|
||||
[%messages path envelopes.u.mailbox]
|
||||
==
|
||||
::
|
||||
++ poke-json
|
||||
|= jon=json
|
||||
^- (quip card _state)
|
||||
|
Loading…
Reference in New Issue
Block a user