mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-13 08:38:43 +03:00
group-push-hook: kick members who are not subscribed
If a ship breaches, it may no longer be subscribed to the group, but still be in it. This causes DM breakage amongst other things. To fix it, we loop over the incoming subscriptions and kick everyone who is a part of a group, but not subscribed to it.
This commit is contained in:
parent
f552492414
commit
2caf1dac24
@ -36,7 +36,68 @@
|
||||
++ on-init on-init:def
|
||||
++ on-save !>(~)
|
||||
++ on-load on-load:def
|
||||
++ on-poke on-poke:def
|
||||
++ on-poke
|
||||
|= [=mark =vase]
|
||||
^- (quip card _this)
|
||||
|^
|
||||
?. =(mark %sane)
|
||||
(on-poke:def mark vase)
|
||||
[sane this]
|
||||
::
|
||||
++ scry-sharing
|
||||
.^ (set resource)
|
||||
%gx
|
||||
(scot %p our.bowl)
|
||||
%group-push-hook
|
||||
(scot %da now.bowl)
|
||||
/sharing/noun
|
||||
==
|
||||
::
|
||||
++ sane
|
||||
^- (list card)
|
||||
%+ murn
|
||||
~(tap in scry-sharing)
|
||||
|= rid=resource
|
||||
^- (unit card)
|
||||
=/ u-g=(unit group)
|
||||
(scry-group:grp rid)
|
||||
?~ u-g
|
||||
`(poke-us %remove rid)
|
||||
=* group u.u-g
|
||||
=/ subs=(set ship)
|
||||
(get-subscribers-for-group rid)
|
||||
=/ to-remove=(set ship)
|
||||
(~(dif in members.group) subs)
|
||||
?~ to-remove ~
|
||||
`(poke-store %remove-members rid to-remove)
|
||||
::
|
||||
++ poke-us
|
||||
|= =action:push-hook
|
||||
^- card
|
||||
=- [%pass / %agent [our.bowl %group-push-hook] %poke -]
|
||||
push-hook-action+!>(action)
|
||||
::
|
||||
++ poke-store
|
||||
|= =update:store
|
||||
^- card
|
||||
=+ group-update+!>(update)
|
||||
[%pass /sane %agent [our.bowl %group-store] %poke -]
|
||||
::
|
||||
++ get-subscribers-for-group
|
||||
|= rid=resource
|
||||
^- (set ship)
|
||||
=/ target=path
|
||||
(en-path:resource rid)
|
||||
%- ~(gas in *(set ship))
|
||||
%+ murn
|
||||
~(val by sup.bowl)
|
||||
|= [her=ship =path]
|
||||
^- (unit ship)
|
||||
?. =(path resource+target)
|
||||
~
|
||||
`her
|
||||
--
|
||||
|
||||
++ on-agent on-agent:def
|
||||
++ on-watch on-watch:def
|
||||
++ on-leave on-leave:def
|
||||
|
@ -8,6 +8,7 @@
|
||||
^- (list term)
|
||||
:~ %graph-pull-hook
|
||||
%group-pull-hook
|
||||
%group-push-hook
|
||||
==
|
||||
::
|
||||
++ poke-all-sane
|
||||
|
Loading…
Reference in New Issue
Block a user