mirror of
https://github.com/urbit/shrub.git
synced 2024-12-22 10:21:31 +03:00
graph-push-hook: compiles and handles %add and %remove forwarding
This commit is contained in:
parent
2dd6e9a661
commit
52b04c515a
@ -134,6 +134,8 @@
|
|||||||
|= $: [=index:store =node:store]
|
|= $: [=index:store =node:store]
|
||||||
[indices=(set index:store) lis=(list [index:store node:store])]
|
[indices=(set index:store) lis=(list [index:store node:store])]
|
||||||
==
|
==
|
||||||
|
~| "cannot put a deleted post into %add-nodes {<post.node>}"
|
||||||
|
?> ?=(%& -.post.node)
|
||||||
=/ l (lent index)
|
=/ l (lent index)
|
||||||
=/ parent-modified=?
|
=/ parent-modified=?
|
||||||
%- ~(rep in indices)
|
%- ~(rep in indices)
|
||||||
@ -144,12 +146,12 @@
|
|||||||
%.n
|
%.n
|
||||||
=((swag [0 k] index) i)
|
=((swag [0 k] index) i)
|
||||||
=/ [ind=index:store =post:store]
|
=/ [ind=index:store =post:store]
|
||||||
(transform index post.node now.bowl parent-modified)
|
(transform index p.post.node now.bowl parent-modified)
|
||||||
:- (~(put in indices) index)
|
:- (~(put in indices) index)
|
||||||
(snoc lis [ind node(post post)])
|
(snoc lis [ind node(p.post post)])
|
||||||
--
|
--
|
||||||
::
|
::
|
||||||
%remove-nodes
|
%remove-posts
|
||||||
?. (is-allowed-remove:hc resource.q.update indices.q.update)
|
?. (is-allowed-remove:hc resource.q.update indices.q.update)
|
||||||
~
|
~
|
||||||
`vas
|
`vas
|
||||||
@ -281,8 +283,9 @@
|
|||||||
++ node-to-indexed-post
|
++ node-to-indexed-post
|
||||||
|= =node:store
|
|= =node:store
|
||||||
^- indexed-post:store
|
^- indexed-post:store
|
||||||
=* index index.post.node
|
?> ?=(%& -.post.node)
|
||||||
[(snag (dec (lent index)) index) post.node]
|
=* index index.p.post.node
|
||||||
|
[(snag (dec (lent index)) index) p.post.node]
|
||||||
::
|
::
|
||||||
++ is-allowed-add
|
++ is-allowed-add
|
||||||
|= [=resource:res nodes=(map index:store node:store)]
|
|= [=resource:res nodes=(map index:store node:store)]
|
||||||
@ -290,13 +293,18 @@
|
|||||||
%- (bond |.(%.n))
|
%- (bond |.(%.n))
|
||||||
%+ biff (get-roles-writers-variation resource)
|
%+ biff (get-roles-writers-variation resource)
|
||||||
|= [is-admin=? writers=(set ship) vip=vip-metadata:metadata]
|
|= [is-admin=? writers=(set ship) vip=vip-metadata:metadata]
|
||||||
|
^- (unit ?)
|
||||||
%- some
|
%- some
|
||||||
%+ levy ~(tap by nodes)
|
%+ levy ~(tap by nodes)
|
||||||
|= [=index:store =node:store]
|
|= [=index:store =node:store]
|
||||||
=/ parent-index=index:store
|
=/ parent-index=index:store
|
||||||
(scag (dec (lent index)) index)
|
(scag (dec (lent index)) index)
|
||||||
?: (~(has by nodes) parent-index) %.y
|
?: (~(has by nodes) parent-index) %.y
|
||||||
?. =(author.post.node src.bowl)
|
?- -.post.node
|
||||||
|
%| %.n
|
||||||
|
::
|
||||||
|
%&
|
||||||
|
?. =(author.p.post.node src.bowl)
|
||||||
%.n
|
%.n
|
||||||
=/ =permissions:store
|
=/ =permissions:store
|
||||||
%^ add-mark resource vip
|
%^ add-mark resource vip
|
||||||
@ -310,7 +318,11 @@
|
|||||||
%self
|
%self
|
||||||
=/ parent-node=node:store
|
=/ parent-node=node:store
|
||||||
(got-node:gra resource parent-index)
|
(got-node:gra resource parent-index)
|
||||||
=(author.post.parent-node src.bowl)
|
?- -.post.parent-node
|
||||||
|
%| %.n
|
||||||
|
%& =(author.p.post.parent-node src.bowl)
|
||||||
|
==
|
||||||
|
==
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ is-allowed-remove
|
++ is-allowed-remove
|
||||||
@ -322,8 +334,13 @@
|
|||||||
%- some
|
%- some
|
||||||
%+ levy ~(tap by indices)
|
%+ levy ~(tap by indices)
|
||||||
|= =index:store
|
|= =index:store
|
||||||
|
^- ?
|
||||||
=/ =node:store
|
=/ =node:store
|
||||||
(got-node:gra resource index)
|
(got-node:gra resource index)
|
||||||
|
?- -.post.node
|
||||||
|
%| %.n
|
||||||
|
::
|
||||||
|
%&
|
||||||
=/ =permissions:store
|
=/ =permissions:store
|
||||||
%^ remove-mark resource vip
|
%^ remove-mark resource vip
|
||||||
(node-to-indexed-post node)
|
(node-to-indexed-post node)
|
||||||
@ -332,7 +349,8 @@
|
|||||||
?- permission-level
|
?- permission-level
|
||||||
%yes %.y
|
%yes %.y
|
||||||
%no %.n
|
%no %.n
|
||||||
%self =(author.post.node src.bowl)
|
%self =(author.p.post.node src.bowl)
|
||||||
|
==
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ build-permissions
|
++ build-permissions
|
||||||
|
Loading…
Reference in New Issue
Block a user