mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-15 18:12:47 +03:00
basic foreign post
This commit is contained in:
parent
6f5c780397
commit
e9b816fbf3
@ -37,6 +37,7 @@
|
|||||||
++ move (pair bone card) :: all actions
|
++ move (pair bone card) :: all actions
|
||||||
++ poke ::
|
++ poke ::
|
||||||
$% {$hall-action action:hall} ::
|
$% {$hall-action action:hall} ::
|
||||||
|
{$collections-action action:api} ::
|
||||||
== ::
|
== ::
|
||||||
++ card ::
|
++ card ::
|
||||||
$% {$info wire ship term nori:clay} ::
|
$% {$info wire ship term nori:clay} ::
|
||||||
@ -75,8 +76,8 @@
|
|||||||
?~ a
|
?~ a
|
||||||
(ta-create:ta ['a description' publ=& visi=& comm=& xeno=& ~])
|
(ta-create:ta ['a description' publ=& visi=& comm=& xeno=& ~])
|
||||||
?@ a
|
?@ a
|
||||||
(ta-submit:ta a 'a topic' ~['with contents'])
|
(ta-submit:ta [`our.bol a] 'a topic' ~['with contents'])
|
||||||
(ta-comment:ta p.a q.a now-id ~['a comment' 'yo'])
|
(ta-comment:ta [`our.bol p.a] q.a now-id ~['a comment' 'yo'])
|
||||||
::
|
::
|
||||||
++ writ
|
++ writ
|
||||||
|= {wir/wire rit/riot:clay}
|
|= {wir/wire rit/riot:clay}
|
||||||
@ -87,6 +88,14 @@
|
|||||||
:: or /web/collections/[col] for each collection and then
|
:: or /web/collections/[col] for each collection and then
|
||||||
:: /web/collections/[col]/[top] for each topic as they get created.
|
:: /web/collections/[col]/[top] for each topic as they get created.
|
||||||
::
|
::
|
||||||
|
++ is-us
|
||||||
|
|= a/coll-full
|
||||||
|
^- ?
|
||||||
|
?~ host.a
|
||||||
|
&
|
||||||
|
=(u.host.a our.bol)
|
||||||
|
::
|
||||||
|
:: need to figure out a more nuanced way to do this for cross-ship
|
||||||
++ ignore-action
|
++ ignore-action
|
||||||
|= act=action:api ^- ?
|
|= act=action:api ^- ?
|
||||||
?- -.act
|
?- -.act
|
||||||
@ -106,9 +115,10 @@
|
|||||||
++ poke-collections-action
|
++ poke-collections-action
|
||||||
|= act=action:api
|
|= act=action:api
|
||||||
^- (quip move _+>)
|
^- (quip move _+>)
|
||||||
?: (ignore-action act)
|
::?: (ignore-action act)
|
||||||
[~ +>]
|
:: [~ +>]
|
||||||
=< ta-done
|
=< ta-done
|
||||||
|
::
|
||||||
?- -.act
|
?- -.act
|
||||||
$create (ta-create:ta +.act)
|
$create (ta-create:ta +.act)
|
||||||
$submit (ta-submit:ta +.act)
|
$submit (ta-submit:ta +.act)
|
||||||
@ -148,28 +158,52 @@
|
|||||||
(ta-write /config now-id %collections-config !>(cof))
|
(ta-write /config now-id %collections-config !>(cof))
|
||||||
::
|
::
|
||||||
++ ta-submit
|
++ ta-submit
|
||||||
|= {col/time tit/cord wat/wain}
|
|= {colful/coll-full tit/cord wat/wain}
|
||||||
|
:: if host is null or we are host
|
||||||
|
?: |(=((need host.colful) our.bol) ?=($~ host.colful))
|
||||||
=/ top/topic [tit src.bol wat]
|
=/ top/topic [tit src.bol wat]
|
||||||
(ta-write /topic [col now-id] %collections-topic !>(top))
|
(ta-write /topic [col.colful now-id] %collections-topic !>(top))
|
||||||
|
%- ta-emit
|
||||||
|
:- ost.bol
|
||||||
|
:^ %poke
|
||||||
|
/foreign-submit
|
||||||
|
[(need host.colful) %collections]
|
||||||
|
[%collections-action [%submit colful tit wat]]
|
||||||
::
|
::
|
||||||
++ ta-resubmit
|
++ ta-resubmit
|
||||||
|= {col/time wen/@da tit/cord wat/wain}
|
|= {colful/coll-full wen/@da tit/cord wat/wain}
|
||||||
?: (new-topic col wen) ta-this ::REVIEW error?
|
?: (new-topic col.colful wen) ta-this ::REVIEW error?
|
||||||
|
?: |(=((need host.colful) our.bol) ?=($~ host.colful))
|
||||||
=/ top/topic [tit src.bol wat]
|
=/ top/topic [tit src.bol wat]
|
||||||
(ta-write /topic [col wen] %collections-topic !>(top))
|
(ta-write /topic [col.colful wen] %collections-topic !>(top))
|
||||||
|
%- ta-emit
|
||||||
|
:- ost.bol
|
||||||
|
:^ %poke
|
||||||
|
/foreign-resubmit
|
||||||
|
[(need host.colful) %collections]
|
||||||
|
[%collections-action [%resubmit colful wen tit wat]]
|
||||||
|
::
|
||||||
::
|
::
|
||||||
++ ta-comment
|
++ ta-comment
|
||||||
|= {col/time top/@da com/?(~ @da) wat/wain}
|
|= {colful/coll-full top/@da com/?(~ @da) wat/wain}
|
||||||
^+ +>
|
^+ +>
|
||||||
|
:: if not for our ship, then proxy
|
||||||
|
?: ?!(|(=((need host.colful) our.bol) ?=($~ host.colful)))
|
||||||
|
%- ta-emit
|
||||||
|
:- ost.bol
|
||||||
|
:^ %poke
|
||||||
|
/foreign-comment
|
||||||
|
[(need host.colful) %collections]
|
||||||
|
[%collections-action [%comment colful top com wat]]
|
||||||
?~ com $(com now-id) :: new comment
|
?~ com $(com now-id) :: new comment
|
||||||
=; res/$@(~ _+>.$) ?^(res res +>.$)
|
=; res/$@(~ _+>.$) ?^(res res +>.$)
|
||||||
%+ biff (ta-get-topic col top)
|
%+ biff (ta-get-topic col.colful top)
|
||||||
|= [^ cos=(map @da {@da comment}) ~]
|
|= [^ cos=(map @da {@da comment}) ~]
|
||||||
=/ old/{@da comment}
|
=/ old/{@da comment}
|
||||||
(fall (~(get by cos) com) [now-id src.bol wat])
|
(fall (~(get by cos) com) [now-id src.bol wat])
|
||||||
?. =(who.old src.bol) ..ta-comment ::REVIEW error?
|
?. =(who.old src.bol) ..ta-comment ::REVIEW error?
|
||||||
%^ ta-write /comment
|
%^ ta-write /comment
|
||||||
[col top com]
|
[col.colful top com]
|
||||||
[%collections-comment !>(`comment`+.old(wat wat))]
|
[%collections-comment !>(`comment`+.old(wat wat))]
|
||||||
::
|
::
|
||||||
++ ta-get-topic
|
++ ta-get-topic
|
||||||
@ -185,24 +219,40 @@
|
|||||||
(~(get by cos) com)
|
(~(get by cos) com)
|
||||||
::
|
::
|
||||||
++ ta-delete
|
++ ta-delete
|
||||||
|= col/time
|
|= colful/coll-full
|
||||||
^+ +>
|
^+ +>
|
||||||
=+ (~(get by cols) col)
|
:: if not for our ship, then proxy
|
||||||
|
?: |(=((need host.colful) our.bol) ?=($~ host.colful))
|
||||||
|
%- ta-emit
|
||||||
|
:- ost.bol
|
||||||
|
:^ %poke
|
||||||
|
/foreign-delete
|
||||||
|
[(need host.colful) %collections]
|
||||||
|
[%collections-action [%delete colful]]
|
||||||
|
=+ (~(get by cols) col.colful)
|
||||||
?~ - ta-this ::REVIEW error?
|
?~ - ta-this ::REVIEW error?
|
||||||
=. ta-this (ta-remove /config col %collections-config)
|
=. ta-this (ta-remove /config col.colful %collections-config)
|
||||||
=/ cyc (circle-for col)
|
=/ cyc (circle-for col.colful)
|
||||||
=. ta-this (ta-hall-action %delete cyc `'Collection deleted')
|
=. ta-this (ta-hall-action %delete cyc `'Collection deleted')
|
||||||
=/ tops=(list [top=@da topicful]) ~(tap by tops.u)
|
=/ tops=(list [top=@da topicful]) ~(tap by tops.u)
|
||||||
|- ^+ ta-this
|
|- ^+ ta-this
|
||||||
?~ tops ta-this
|
?~ tops ta-this
|
||||||
=. ta-this $(tops t.tops)
|
=. ta-this $(tops t.tops)
|
||||||
(ta-delete-topic-inf 'Collection deleted' col i.tops)
|
(ta-delete-topic-inf 'Collection deleted' col.colful i.tops)
|
||||||
::
|
::
|
||||||
++ ta-delete-topic
|
++ ta-delete-topic
|
||||||
|= {col/time top/@da} ^+ ta-this
|
|= {colful/coll-full top/@da} ^+ ta-this
|
||||||
=+ (ta-get-topic col top)
|
:: if not for our ship, then proxy
|
||||||
|
?: |(=((need host.colful) our.bol) ?=($~ host.colful))
|
||||||
|
%- ta-emit
|
||||||
|
:- ost.bol
|
||||||
|
:^ %poke
|
||||||
|
/foreign-delete-topic
|
||||||
|
[(need host.colful) %collections]
|
||||||
|
[%collections-action [%delete-topic colful top]]
|
||||||
|
=+ (ta-get-topic col.colful top)
|
||||||
?~ - ta-this ::REVIEW error?
|
?~ - ta-this ::REVIEW error?
|
||||||
(ta-delete-topic-inf 'Topic deleted' col top u)
|
(ta-delete-topic-inf 'Topic deleted' col.colful top u)
|
||||||
::
|
::
|
||||||
++ ta-delete-topic-inf ::REVIEW name
|
++ ta-delete-topic-inf ::REVIEW name
|
||||||
|= {inf/@t col/time top/@da tof/topicful}
|
|= {inf/@t col/time top/@da tof/topicful}
|
||||||
@ -216,10 +266,18 @@
|
|||||||
(ta-remove /comment [col top com.i.coms] %collections-comment)
|
(ta-remove /comment [col top com.i.coms] %collections-comment)
|
||||||
::
|
::
|
||||||
++ ta-delete-comment
|
++ ta-delete-comment
|
||||||
|= {col/time top/@da com/@da} ^+ +>
|
|= {colful/coll-full top/@da com/@da} ^+ +>
|
||||||
=+ (ta-get-comment col top com)
|
:: if not for our ship, then proxy
|
||||||
|
?: |(=((need host.colful) our.bol) ?=($~ host.colful))
|
||||||
|
%- ta-emit
|
||||||
|
:- ost.bol
|
||||||
|
:^ %poke
|
||||||
|
/foreign-delete-comment
|
||||||
|
[(need host.colful) %collections]
|
||||||
|
[%collections-action [%delete-comment colful top com]]
|
||||||
|
=+ (ta-get-comment col.colful top com)
|
||||||
?~ - ta-this ::REVIEW error?
|
?~ - ta-this ::REVIEW error?
|
||||||
(ta-remove /comment [col top com] %collections-comment)
|
(ta-remove /comment [col.colful top com] %collections-comment)
|
||||||
::
|
::
|
||||||
:: %writing-files
|
:: %writing-files
|
||||||
::
|
::
|
||||||
|
@ -16,13 +16,17 @@
|
|||||||
=, dejs:format
|
=, dejs:format
|
||||||
:: %+ cu |=(action +<)
|
:: %+ cu |=(action +<)
|
||||||
=< action
|
=< action
|
||||||
|
::(action a)
|
||||||
|%
|
|%
|
||||||
++ action
|
++ action
|
||||||
|
|= a/json
|
||||||
|
^- action
|
||||||
|
%. a
|
||||||
%- of :~
|
%- of :~
|
||||||
create+create
|
create+create
|
||||||
delete+(ot col+(se %da) ~)
|
delete+(ot col+(se %da) ~)
|
||||||
submit+(ot col+(se %da) tit+so wat+wain ~)
|
submit+submit
|
||||||
comment+(ot col+(se %da) top+(se %da) com+null-or-da wat+wain ~)
|
comment+comment
|
||||||
resubmit+(ot col+(se %da) top+(se %da) tit+so wat+wain ~)
|
resubmit+(ot col+(se %da) top+(se %da) tit+so wat+wain ~)
|
||||||
delete-topic+(ot col+(se %da) top+(se %da) ~)
|
delete-topic+(ot col+(se %da) top+(se %da) ~)
|
||||||
delete-comment+(ot col+(se %da) top+(se %da) com+(se %da) ~)
|
delete-comment+(ot col+(se %da) top+(se %da) com+(se %da) ~)
|
||||||
@ -33,11 +37,30 @@
|
|||||||
%+ cu |=(a=coin ?+(a !! [%$ ^] p.a))
|
%+ cu |=(a=coin ?+(a !! [%$ ^] p.a))
|
||||||
(su nuck:so.hoon)
|
(su nuck:so.hoon)
|
||||||
::
|
::
|
||||||
|
++ submit
|
||||||
|
|= a=json
|
||||||
|
^- [coll-full @t wain]
|
||||||
|
=/ host
|
||||||
|
%. a
|
||||||
|
(ot:dejs-soft:format hos+(se-soft %p) ~)
|
||||||
|
=+ ^- [col=@da tit=@t wat=wain]
|
||||||
|
%. a
|
||||||
|
(ot col+(se %da) tit+so wat+wain ~)
|
||||||
|
[[host col] tit wat]
|
||||||
|
::
|
||||||
|
++ comment
|
||||||
|
|= a=json
|
||||||
|
=/ host
|
||||||
|
%. a
|
||||||
|
(ot:dejs-soft:format hos+(se-soft %p) ~)
|
||||||
|
=+ ^- [col=@da top=@da com=?(~ @da) wat=wain]
|
||||||
|
%. a
|
||||||
|
(ot col+(se %da) top+(se %da) com+null-or-da wat+wain ~)
|
||||||
|
[[host col] top com wat]
|
||||||
++ create
|
++ create
|
||||||
:: (ot wat+(cu (hard kind) so) des+so pub+bo vis+bo ses+(as (se %p)) ~)
|
:: (ot wat+(cu (hard kind) so) des+so pub+bo vis+bo ses+(as (se %p)) ~)
|
||||||
|= a=json
|
|= a=json
|
||||||
~| a
|
~| a
|
||||||
::=+ ^- [wat=kind des=cord pub=? vis=? ses=(set @p)]
|
|
||||||
=+ ^- [desc=cord publ=? visi=? comm=? xeno=? ses=(set @p)]
|
=+ ^- [desc=cord publ=? visi=? comm=? xeno=? ses=(set @p)]
|
||||||
%. a
|
%. a
|
||||||
:: change this to accept an array of @p
|
:: change this to accept an array of @p
|
||||||
@ -66,5 +89,13 @@
|
|||||||
|= b=cord ^- (odo:raid a)
|
|= b=cord ^- (odo:raid a)
|
||||||
(slav a b)
|
(slav a b)
|
||||||
so
|
so
|
||||||
|
++ se-soft :: string as aura
|
||||||
|
=, wired
|
||||||
|
|* a=term
|
||||||
|
%+ cu
|
||||||
|
|= b=(unit cord) ^- (unit (odo:raid a))
|
||||||
|
?~ b ~
|
||||||
|
`(slav a (need b))
|
||||||
|
so:dejs-soft:format
|
||||||
-- --
|
-- --
|
||||||
--
|
--
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
tops/(map @da topicful) ::
|
tops/(map @da topicful) ::
|
||||||
$~ :: /. compatibility
|
$~ :: /. compatibility
|
||||||
== ::
|
== ::
|
||||||
|
++ coll-full
|
||||||
|
{host/(unit @p) col/time}
|
||||||
++ topicful ::
|
++ topicful ::
|
||||||
$: info/{mod/@da topic} ::
|
$: info/{mod/@da topic} ::
|
||||||
coms/(map @da {mod/@da comment}) ::
|
coms/(map @da {mod/@da comment}) ::
|
||||||
@ -47,14 +49,14 @@
|
|||||||
xeno/? :: others can post
|
xeno/? :: others can post
|
||||||
ses/(set ship) :: black/whitelist
|
ses/(set ship) :: black/whitelist
|
||||||
== ::
|
== ::
|
||||||
{$submit col/time tit/cord wat/wain} :: submit a post/note
|
{$submit col/coll-full tit/cord wat/wain}
|
||||||
{$resubmit col/time top/@da tit/cord wat/wain} :: edit a post/note
|
{$resubmit col/coll-full top/@da tit/cord wat/wain} :: edit a post/note
|
||||||
{$comment col/time top/@da com/?(~ @da) wat/wain} :: submit a comment
|
{$comment col/coll-full top/@da com/?(~ @da) wat/wain} :: submit a comment
|
||||||
{$delete col/time} :: delete a collection
|
{$delete col/coll-full} :: delete a collection
|
||||||
::
|
::
|
||||||
::REVIEW names? nest collection/topic/comment actions?
|
::REVIEW names? nest collection/topic/comment actions?
|
||||||
{$delete-topic col/time top/@da} :: delete a collection
|
{$delete-topic col/coll-full top/@da} :: delete a collection
|
||||||
{$delete-comment col/time top/@da com/@da} :: delete a collection
|
{$delete-comment col/coll-full top/@da com/@da} :: delete a collection
|
||||||
== ::
|
== ::
|
||||||
--
|
--
|
||||||
--
|
--
|
||||||
|
Loading…
Reference in New Issue
Block a user