mirror of
https://github.com/urbit/shrub.git
synced 2024-11-28 22:33:06 +03:00
graph-view: add delete, leave threads
This commit is contained in:
parent
47561d806f
commit
08dab6c5b0
@ -2,12 +2,23 @@
|
||||
/+ resource
|
||||
^?
|
||||
|%
|
||||
++ error
|
||||
$%
|
||||
[%offline =ship]
|
||||
[%no-permissions ~]
|
||||
==
|
||||
++ action
|
||||
:: $error: An error from a graph-view poke
|
||||
::
|
||||
:: %offline: Ship is offline
|
||||
:: %bad-perms: Not permitted
|
||||
:: %unknown: Anything not described above
|
||||
::
|
||||
+$ error
|
||||
?(%offline %bad-perms %unknown)
|
||||
:: $action: A semantic action on graphs
|
||||
::
|
||||
:: %create: Create a graph and associated metadata
|
||||
:: %delete: Delete a graph
|
||||
:: %join: Join a graph
|
||||
:: %invite: Invite users to a graph
|
||||
:: %groupify: Make graph into managed group
|
||||
::
|
||||
+$ action
|
||||
$%
|
||||
$: %create
|
||||
rid=resource
|
||||
|
61
pkg/arvo/ted/graph/delete.hoon
Normal file
61
pkg/arvo/ted/graph/delete.hoon
Normal file
@ -0,0 +1,61 @@
|
||||
/- spider, graph-view, graph=graph-store, *metadata-store, *group
|
||||
/+ strandio, resource
|
||||
=>
|
||||
|%
|
||||
++ strand strand:spider
|
||||
++ poke poke:strandio
|
||||
++ poke-our poke-our:strandio
|
||||
++ scry-metadata
|
||||
|= rid=resource
|
||||
=/ m (strand ,(unit resource))
|
||||
;< pax=(unit path) bind:m
|
||||
%+ scry:strandio ,(unit path)
|
||||
;: weld
|
||||
/gx/metadata-store/resource/graph
|
||||
(en-path:resource rid)
|
||||
/noun
|
||||
==
|
||||
(pure:m (bind pax de-path:resource))
|
||||
++ scry-group
|
||||
|= rid=resource
|
||||
=/ m (strand ,(unit resource))
|
||||
;< ugroup=(unit group) bind:m
|
||||
%+ scry:strandio ,(unit group)
|
||||
;: weld
|
||||
/gx/group-store/resource/graph
|
||||
(en-path:resource rid)
|
||||
/noun
|
||||
==
|
||||
(pure:m (need ugroup))
|
||||
++ delete-graph
|
||||
|= rid=resource
|
||||
=/ m (strand ,~)
|
||||
;< ~ bind:m
|
||||
(poke-our %graph-push-hook %push-hook-action [%remove rid.action])
|
||||
;< ~ bind:m
|
||||
(poke-our %graph-store %graph-update [%archive-graph rid.action])
|
||||
(pure:m ~)
|
||||
--
|
||||
^- thread:spider
|
||||
|= arg=vase
|
||||
=/ m (strand ,vase)
|
||||
^- form:m
|
||||
=+ !<([=action:graph-view ~] arg)
|
||||
?> ?=(%delete -.action)
|
||||
;< =bowl:spider bind:m get-bowl:strandio
|
||||
?> =(our.bowl entity.rid.action)
|
||||
;< ugroup-rid=(unit resource) bind:m
|
||||
(scry-metadata rid.action)
|
||||
?~ ugroup-rid (fail:m %nonexistent)
|
||||
;< ugroup=(unit group)
|
||||
(scry-group u.ugroup-rid)
|
||||
?~ ugroup (fail:m %nonexistent)
|
||||
?. hidden.u.ugroup
|
||||
(delete-graph rid.action)
|
||||
;< ~ bind:m
|
||||
(poke-our %group-push-hook %pull-hook-action [%remove rid.action])
|
||||
;< ~ bind:m
|
||||
(poke-our %group-store %group-action !>([%remove-group rid.action])
|
||||
;< ~ bind:m (delete-graph rid.action)
|
||||
(pure:m !>(~))
|
||||
|
@ -29,9 +29,9 @@
|
||||
(scry-metadata rid.action)
|
||||
?^ group
|
||||
:: We have group, graph is managed
|
||||
:: ;< ~ bind:m
|
||||
:: %+ poke-our %graph-pull-hook
|
||||
:: pull-hook-action+!>([%add ship.action rid.action])
|
||||
;< ~ bind:m
|
||||
%+ poke-our %graph-pull-hook
|
||||
pull-hook-action+!>([%add ship.action rid.action])
|
||||
(pure:m !>(~))
|
||||
:: Else, add group then join
|
||||
;< ~ bind:m
|
||||
|
61
pkg/arvo/ted/graph/leave.hoon
Normal file
61
pkg/arvo/ted/graph/leave.hoon
Normal file
@ -0,0 +1,61 @@
|
||||
/- spider, graph-view, graph=graph-store, *metadata-store, *group
|
||||
/+ strandio, resource
|
||||
=>
|
||||
|%
|
||||
++ strand strand:spider
|
||||
++ poke poke:strandio
|
||||
++ poke-our poke-our:strandio
|
||||
++ scry-metadata
|
||||
|= rid=resource
|
||||
=/ m (strand ,(unit resource))
|
||||
;< pax=(unit path) bind:m
|
||||
%+ scry:strandio ,(unit path)
|
||||
;: weld
|
||||
/gx/metadata-store/resource/graph
|
||||
(en-path:resource rid)
|
||||
/noun
|
||||
==
|
||||
(pure:m (bind pax de-path:resource))
|
||||
++ scry-group
|
||||
|= rid=resource
|
||||
=/ m (strand ,(unit resource))
|
||||
;< ugroup=(unit group) bind:m
|
||||
%+ scry:strandio ,(unit group)
|
||||
;: weld
|
||||
/gx/group-store/resource/graph
|
||||
(en-path:resource rid)
|
||||
/noun
|
||||
==
|
||||
(pure:m (need ugroup))
|
||||
++ delete-graph
|
||||
|= rid=resource
|
||||
=/ m (strand ,~)
|
||||
;< ~ bind:m
|
||||
(poke-our %graph-pull-hook %pull-hook-action [%remove rid.action])
|
||||
;< ~ bind:m
|
||||
(poke-our %graph-store %graph-update [%archive-graph rid.action])
|
||||
(pure:m ~)
|
||||
--
|
||||
^- thread:spider
|
||||
|= arg=vase
|
||||
=/ m (strand ,vase)
|
||||
^- form:m
|
||||
=+ !<([=action:graph-view ~] arg)
|
||||
?> ?=(%leave -.action)
|
||||
;< =bowl:spider bind:m get-bowl:strandio
|
||||
?< =(our.bowl entity.rid.action)
|
||||
;< ugroup-rid=(unit resource) bind:m
|
||||
(scry-metadata rid.action)
|
||||
?~ ugroup-rid (fail:m %nonexistent)
|
||||
;< ugroup=(unit group)
|
||||
(scry-group u.ugroup-rid)
|
||||
?~ ugroup (fail:m %nonexistent)
|
||||
?. hidden.u.ugroup
|
||||
(delete-graph rid.action)
|
||||
;< ~ bind:m
|
||||
(poke-our %group-push-hook %pull-hook-action [%remove rid.action])
|
||||
;< ~ bind:m
|
||||
(poke-our %group-store %group-action !>([%remove-group rid.action])
|
||||
;< ~ bind:m (delete-graph rid.action)
|
||||
(pure:m !>(~))
|
||||
|
Loading…
Reference in New Issue
Block a user