urbit/pkg/arvo/app/fora.hoon

105 lines
2.2 KiB
Plaintext
Raw Normal View History

::
:: /app/fora/hoon
::
::TODO maybe stop relying on %hood one day.
::
/- hall
2017-12-07 01:24:24 +03:00
/+ hall, time-to-id
=, format
=, title
::
|%
++ move (pair bone card)
++ card
$% {$poke wire dock poke}
{$info wire @p toro:clay}
==
++ poke
$% {$hall-action action:hall}
{$write-fora-post spur ship cord cord}
{$write-comment spur ship cord}
==
--
::
2018-03-19 07:18:20 +03:00
|_ {bol/bowl:gall ~}
::
++ prep
2018-03-19 07:18:20 +03:00
|= old/(unit ~)
^- (quip move _..prep)
?^ old [~ ..prep(+<+ u.old)]
:_ ..prep
:~ (act %create %fora-posts 'fora posts' %journal)
(act %create %fora-comments 'fora comments' %journal)
==
::
++ act
|= a/action:hall
^- move
[ost.bol %poke / [our.bol %hall] %hall-action a]
::
2019-07-04 02:01:45 +03:00
++ ra-base-hart .^(hart:eyre %e /(scot %p our.bol)/host/(scot %da now.bol))
::
++ poke-fora-post
|= {pax/path sup/spur hed/@t txt/@t}
^- (quip move _+>)
:_ +>
::
2018-05-09 22:30:15 +03:00
:: if txt is blank then return no moves.
::
2018-05-09 22:30:15 +03:00
?: ?=(^ (rush txt spac:de-json:html)) ~
::
2018-05-09 22:30:15 +03:00
:: otherwise, post the content.
::
:~ %- act
:+ %phrase [[our.bol %fora-posts] ~ ~]
:_ ~
:+ %app dap.bol
:+ %fat
:+ %name
(crip "post by {(cite src.bol)}: {(trip hed)}")
text+(to-wain txt)
=. pax (welp pax /posts/(crip "{<now.bol>}~"))
[%url [ra-base-hart `pax ~] ~]
::
:* ost.bol
%poke
/fora-post
[our.bol %hood]
[%write-fora-post sup src.bol hed txt]
==
==
::
++ poke-fora-comment
|= {pax/path sup/spur txt/@t}
^- (quip move _+>)
:_ +>
::
2018-05-09 22:30:15 +03:00
:: if txt is blank then return no moves.
::
2018-05-09 22:30:15 +03:00
?: ?=(^ (rush txt spac:de-json:html)) ~
::
2018-05-09 22:30:15 +03:00
:: otherwise, post the content.
::
:~ ^- move
%- act
:+ %phrase [[our.bol %fora-comments] ~ ~]
:_ ~
:+ %app dap.bol
^- speech:hall
:+ %fat
:+ %name
=+ nam=?~(sup "" (trip i.sup))
(crip "comment by {(cite src.bol)} on /{nam}")
text+(to-wain txt)
=+ fra=(crip (time-to-id now.bol))
[%url [ra-base-hart `pax ~] `fra]
::
:* ost.bol
%poke
/fora-comment
[our.bol %hood]
[%write-comment sup src.bol txt]
==
==
--