urbit/pkg/landscape/mar/graph/validator/post.hoon

54 lines
1.2 KiB
Plaintext
Raw Normal View History

/- *post, met=metadata-store, graph=graph-store, hark=hark-graph-hook
|_ i=indexed-post
++ grow
|%
++ noun i
::
++ graph-indexed-post
^- indexed-post
?> ?=(^ contents.p.i)
i
::
++ graph-permissions-add
|= vip=vip-metadata:met
^- permissions:graph
?. ?=([@ ~] index.p.i)
[%yes %yes %yes]
2021-04-02 04:48:09 +03:00
?+ vip [%yes %yes %yes]
%admin-feed [%yes %no %no]
2021-04-02 04:48:09 +03:00
%host-feed [%no %no %no]
==
::
++ graph-permissions-remove
|= vip=vip-metadata:met
^- permissions:graph
[%yes %self %self]
:: +notification-kind: don't track unreads, notify on replies
::
++ notification-kind
^- (unit notif-kind:hark)
=/ len (lent index.p.i)
=/ =mode:hark
?:(=(1 len) %count %none)
`[%post [(dec len) len] mode %children]
::
2021-03-24 05:08:44 +03:00
++ transform-add-nodes
|= [=index =post =atom was-parent-modified=?]
^- [^index ^post]
=- [- post(index -)]
?~ index !!
?: ?=([@ ~] index)
[atom ~]
?: was-parent-modified
~|(%cannot-submit-parents-with-prepopulated-children !!)
=/ ind=^index index
(snoc (snip ind) atom)
--
++ grab
|%
++ noun indexed-post
--
::
++ grad %noun
--