chat-hook: on-migrate, delete permission-hook entry
If we don't host a group, we can't (locally) delete it, but we do still
have a permission-hook entry we want to clean up. This does that
deletion, but still relies on the permission-hook logic to clean it up
in the local group case.
/keys
|^ |= chat=path
^- (list card)
+ =/ host=ship (slav %p (snag 0 chat))
=/ newp=permission (unify-permissions chat)
=/ old-group=path [%chat chat]
=/ new-group=path [%'~' chat]
;: weld
- :~ (delete-group (snoc old-group %read))
- (delete-group (snoc old-group %write))
+ :~ (delete-group host (snoc old-group %read))
+ (delete-group host (snoc old-group %write))
==
::
(create-group new-group who.newp)
[%pass /on-load/[app]/[mark] %agent [our.bol app] %poke mark vase]
::
++ delete-group
- |= group=path
+ |= [host=ship group=path]
^- card
+ :: if we host the group, delete it directly
+ ::
+ ?: =(our.bol host)
%^ make-poke %group-store
%group-action
!> ^- group-action
[%unbundle group]
+ :: else, just delete the sync in the hook
+ ::
+ %^ make-poke %permission-hook
+ %permission-hook-action
+ !> ^- permission-hook-action
+ [%remove group]
::
++ create-group
|= [group=path who=(set ship)]
