mirror of
https://github.com/ilyakooo0/urbit.git
synced 2025-01-05 05:45:46 +03:00
group-view: add leave, delete threads
This commit is contained in:
parent
a6e1459395
commit
d5bfe028e8
@ -1,5 +1,5 @@
|
||||
/- sur=group-view
|
||||
/+ resource
|
||||
/- sur=group-view, spider
|
||||
/+ resource, strandio, metadata=metadata-store
|
||||
^?
|
||||
=< [. sur]
|
||||
=, sur
|
||||
@ -46,4 +46,22 @@
|
||||
:_ s+prog
|
||||
(enjs-path:resource rid)
|
||||
--
|
||||
++ cleanup-md
|
||||
|= rid=resource
|
||||
=/ m (strand:spider ,~)
|
||||
^- form:m
|
||||
;< =associations:metadata bind:m
|
||||
%+ scry:strandio associations:metadata
|
||||
%+ weld /metadata-store/group
|
||||
(snoc (en-path:resource rid) %noun)
|
||||
=/ assocs=(list [=md-resource:metadata association:metadata])
|
||||
~(tap by associations)
|
||||
|-
|
||||
=* loop $
|
||||
?~ assocs
|
||||
(pure:m ~)
|
||||
;< ~ bind:m
|
||||
%+ poke-our:strandio %metadata-store
|
||||
metadata-action+!>([%remove rid md-resource.i.assocs])
|
||||
loop(assocs t.assocs)
|
||||
--
|
||||
|
46
pkg/arvo/ted/group/delete.hoon
Normal file
46
pkg/arvo/ted/group/delete.hoon
Normal file
@ -0,0 +1,46 @@
|
||||
/- spider,
|
||||
metadata=metadata-store,
|
||||
*group,
|
||||
inv=invite-store,
|
||||
store=group-store,
|
||||
push-hook
|
||||
/+ strandio, resource, view=group-view
|
||||
=>
|
||||
|%
|
||||
++ strand strand:spider
|
||||
++ poke poke:strandio
|
||||
++ poke-our poke-our:strandio
|
||||
++ cleanup-md
|
||||
|= rid=resouce
|
||||
=/ m (strand ,~)
|
||||
^- form:m
|
||||
;< =associations:metadata bind:m
|
||||
%+ scry:strandio associations:metadata
|
||||
%+ weld /metadata-store/group
|
||||
(snoc (en-path:resource rid) %noun)
|
||||
=/ assocs=(list [=md-resource:metadata association:metadata])
|
||||
~(tap by associations)
|
||||
|-
|
||||
=* loop $
|
||||
?~ assocs
|
||||
(pure:m ~)
|
||||
;< ~ bind:m
|
||||
(poke-our %metadata-store metadata-action+!>([%remove rid md-resource.i.assocs]))
|
||||
loop(assocs t.assocs)
|
||||
--
|
||||
^- thread:spider
|
||||
|= arg=vase
|
||||
=/ m (strand ,vase)
|
||||
=+ !<([~ =action:view] arg)
|
||||
?> ?=(%remove -.action)
|
||||
;< =bowl:spider bind:m get-bowl:strandio
|
||||
?> =(our.bowl entity.resource.action)
|
||||
=/ push-hook-act=cage
|
||||
:- %push-hook-action
|
||||
!> ^- action:push-hook
|
||||
[%remove resource.action]
|
||||
;< ~ bind:m (cleanup-md:view rid)
|
||||
;< ~ bind:m (poke-our %group-store %group-update !>([%remove-group rid ~]))
|
||||
;< ~ bind:m (poke-our %metadata-push-hook push-hook-act)
|
||||
;< ~ bind:m (poke-our %group-push-hook push-hook-act)
|
||||
(pure:m !>(~))
|
30
pkg/arvo/ted/group/leave.hoon
Normal file
30
pkg/arvo/ted/group/leave.hoon
Normal file
@ -0,0 +1,30 @@
|
||||
/- spider,
|
||||
metadata=metadata-store,
|
||||
*group,
|
||||
inv=invite-store,
|
||||
store=group-store,
|
||||
pull-hook
|
||||
/+ strandio, resource, view=group-view
|
||||
=>
|
||||
|%
|
||||
++ strand strand:spider
|
||||
++ poke poke:strandio
|
||||
++ poke-our poke-our:strandio
|
||||
--
|
||||
^- thread:spider
|
||||
|= arg=vase
|
||||
=/ m (strand ,vase)
|
||||
=+ !<([~ =action:view] arg)
|
||||
?> ?=(%leave -.action)
|
||||
;< =bowl:spider bind:m get-bowl:strandio
|
||||
?> =(our.bowl entity.resource.action)
|
||||
=* rid resource.action
|
||||
=/ pull-hook-act=cage
|
||||
:- %pull-hook-action
|
||||
!> ^- action:pull-hook
|
||||
[%remove rid]
|
||||
;< ~ bind:m (cleanup-md:view rid)
|
||||
;< ~ bind:m (poke-our %group-store %group-update !>([%remove-group rid ~]))
|
||||
;< ~ bind:m (poke-our %metadata-pull-hook pull-hook-act)
|
||||
;< ~ bind:m (poke-our %group-pull-hook pull-hook-act)
|
||||
(pure:m !>(~))
|
Loading…
Reference in New Issue
Block a user