mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-15 01:52:42 +03:00
sane: fix accidental self kick
Does not remove ourselves from the group when run. Additionally adds card preview support to the inside app pokes. Fixes urbit/landscape#442
This commit is contained in:
parent
79f461f5c9
commit
66d9fd8426
@ -42,7 +42,7 @@
|
||||
|^
|
||||
?. =(mark %sane)
|
||||
(on-poke:def mark vase)
|
||||
[sane this]
|
||||
[(sane !<(?(%check %fix) vase)) this]
|
||||
::
|
||||
++ scry-sharing
|
||||
.^ (set resource)
|
||||
@ -54,7 +54,12 @@
|
||||
==
|
||||
::
|
||||
++ sane
|
||||
|= input=?(%check %fix)
|
||||
^- (list card)
|
||||
=; cards=(list card)
|
||||
?: =(%check input)
|
||||
~&(cards ~)
|
||||
cards
|
||||
%+ murn
|
||||
~(tap in scry-sharing)
|
||||
|= rid=resource
|
||||
@ -67,7 +72,7 @@
|
||||
=/ subs=(set ship)
|
||||
(get-subscribers-for-group rid)
|
||||
=/ to-remove=(set ship)
|
||||
(~(dif in members.group) subs)
|
||||
(~(dif in members.group) (~(gas in subs) our.bowl ~))
|
||||
?~ to-remove ~
|
||||
`(poke-store %remove-members rid to-remove)
|
||||
::
|
||||
|
@ -30,7 +30,7 @@
|
||||
::
|
||||
::
|
||||
/- *group
|
||||
/+ store=group-store, default-agent, verb, dbug, resource, *migrate
|
||||
/+ store=group-store, default-agent, verb, dbug, resource, *migrate, agentio
|
||||
|%
|
||||
+$ card card:agent:gall
|
||||
::
|
||||
@ -111,6 +111,8 @@
|
||||
?> (team:title our.bowl src.bowl)
|
||||
=^ cards state
|
||||
?+ mark (on-poke:def mark vase)
|
||||
%sane (poke-sane:gc !<(?(%check %fix) vase))
|
||||
::
|
||||
?(%group-update %group-action)
|
||||
(poke-group-update:gc !<(update:store vase))
|
||||
::
|
||||
@ -189,6 +191,7 @@
|
||||
--
|
||||
::
|
||||
|_ bol=bowl:gall
|
||||
+* io ~(. agentio bol)
|
||||
++ peek-group
|
||||
|= rid=resource
|
||||
^- (unit group)
|
||||
@ -213,6 +216,27 @@
|
||||
(~(has in ban-ranks.policy) (clan:title ship))
|
||||
==
|
||||
==
|
||||
++ poke-sane
|
||||
|= input=?(%check %fix)
|
||||
^- (quip card _state)
|
||||
=; cards=(list card)
|
||||
?: =(%check input)
|
||||
~& cards
|
||||
`state
|
||||
[cards state]
|
||||
%+ roll ~(tap in ~(key by groups))
|
||||
|= [rid=resource out=(list card)]
|
||||
?. ?& =(entity.rid our.bol)
|
||||
!(~(has in members:(~(got by groups) rid)) our.bol)
|
||||
==
|
||||
out
|
||||
=/ =wire
|
||||
sane+(en-path:resource rid)
|
||||
=* poke-self ~(poke-self pass:io wire)
|
||||
%+ weld out
|
||||
:~ (poke-self group-update+!>([%add-members rid (silt our.bol ~)]))
|
||||
(poke-self group-update+!>([%add-tag rid %admin (silt our.bol ~)]))
|
||||
==
|
||||
::
|
||||
++ poke-import
|
||||
|= arc=*
|
||||
|
@ -3,15 +3,16 @@
|
||||
=>
|
||||
|%
|
||||
++ strand strand:spider
|
||||
+$ input ?(%fix %check)
|
||||
::
|
||||
++ supported-apps
|
||||
^- (list term)
|
||||
:~ %graph-pull-hook
|
||||
%group-pull-hook
|
||||
%group-push-hook
|
||||
:~ %group-push-hook
|
||||
%group-store
|
||||
==
|
||||
::
|
||||
++ poke-all-sane
|
||||
|= =input
|
||||
=/ m (strand ,~)
|
||||
^- form:m
|
||||
=/ apps supported-apps
|
||||
@ -19,13 +20,14 @@
|
||||
?~ apps
|
||||
(pure:m ~)
|
||||
=* app i.apps
|
||||
;< ~ bind:m (poke-our app sane+!>(%sane))
|
||||
;< ~ bind:m (poke-our app sane+!>(input))
|
||||
loop(apps t.apps)
|
||||
--
|
||||
::
|
||||
^- thread:spider
|
||||
|= vase
|
||||
|= vas=vase
|
||||
=/ m (strand ,vase)
|
||||
;< ~ bind:m poke-all-sane
|
||||
;< ~ bind:m (poke-our %sane noun+!>(%fix))
|
||||
=+ !<([~ in=input] vas)
|
||||
;< ~ bind:m (poke-all-sane in)
|
||||
;< ~ bind:m (poke-our %sane noun+!>(in))
|
||||
(pure:m !>("Done"))
|
||||
|
Loading…
Reference in New Issue
Block a user