Merge pull request #1328 from urbit/modulo-publish

Modulo publish app
This commit is contained in:
Jared Tobin 2019-07-12 07:44:03 +08:00 committed by GitHub
commit 1a0111a83e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 245 additions and 248 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ff940a247fd3165fe55bd51f67762e857d63bb06220672599cc9e76ccf9f9e8e
size 5846934
oid sha256:f643e9f47f00558c8b900bc3d37ed9e5b2c38afae31e80cb106fb32042d8bcbb
size 5976443

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:980cc9a756e49e6ba600ebfef91d09735eae1239da265cbc78fb6f783eab0f4c
size 8481672
oid sha256:cb9b9c4c37608ba908e1890928cfa8b4f7b9d5d236accf6af7eac6288950db74
size 8632073

View File

@ -1,37 +1,37 @@
::
:: /app/write.hoon
:: /app/publish.hoon
::
/- hall, *write
/+ *server, *write
/- hall, *publish
/+ *server, *publish
::
/= index
/^ $-(json manx)
/: /===/app/write/index /!noun/
/: /===/app/publish/index /!noun/
::
/= js
/^ octs
/; as-octs:mimes:html
/| /: /===/app/write/js/index /js/
/| /: /===/app/publish/js/index /js/
/~ ~
==
::
/= css
/^ octs
/; as-octs:mimes:html
/| /: /===/app/write/css/index /css/
/| /: /===/app/publish/css/index /css/
/~ ~
==
::
/= tile-js
/^ octs
/; as-octs:mimes:html
/| /: /===/app/write/js/tile /js/
/| /: /===/app/publish/js/tile /js/
/~ ~
==
::
/= images
/^ (map knot @)
/: /===/app/write/img /_ /png/
/: /===/app/publish/img /_ /png/
::
|%
::
@ -54,26 +54,46 @@
::
+$ poke
$% [%hall-action action:hall]
[%write-action action]
[%publish-action action]
[%launch-action @tas path @t]
==
::
+$ diff
$% [%hall-rumor rumor:hall]
[%json json]
[%write-collection collection]
[%write-rumor rumor]
[%write-update update]
[%publish-collection collection]
[%publish-rumor rumor]
[%publish-update update]
==
::
--
::
|_ [bol=bowl:gall sat=state]
|_ [bol=bowl:gall %0 sat=state]
::
++ this .
:: +our-beak: beak for this app, with case set to current invocation date
::
++ our-beak /(scot %p our.bol)/[q.byk.bol]/(scot %da now.bol)
:: +prep: set up eyre connection and modulo tile; adapt state
::
++ prep
=> |%
++ states
$% [%0 s=state]
==
--
|= old=(unit states)
^- (quip move _this)
?~ old
:_ this
:~ [ost.bol %connect / [~ /'~publish'] %publish]
:* ost.bol %poke /publish [our.bol %launch]
%launch-action %publish /publishtile '/~publish/tile.js'
==
==
?- -.u.old
%0 [~ this(sat s.u.old)]
==
::
++ ships-to-whom
|= ships=(set @p)
@ -86,7 +106,7 @@
++ get-contributors
|= coll=@tas
^- [mod=?(%white %black) who=(set @p)]
=/ pax (weld our-beak /web/write/[coll])
=/ pax (weld our-beak /web/publish/[coll])
=/ pem=[r=dict:clay w=dict:clay] .^([dict:clay dict:clay] %cp pax)
:- mod.rul.w.pem
(resolve-real rul.w.pem)
@ -180,21 +200,6 @@
[' ==' ~]
==
::
++ prep
|= old=(unit *)
^- (quip move _this)
~& write-prep+act.bol
?~ old
:_ this(sat *state)
:~ [ost.bol %connect / [~ /'~publish'] %write]
:* ost.bol %poke /publish [our.bol %launch]
%launch-action %write /publishtile '/~publish/tile.js'
==
==
::
:: [~ this(sat *state)]
[~ this(sat (state u.old))]
::
++ poke-noun
|= a=*
^- (quip move _this)
@ -202,23 +207,10 @@
[~ this]
?+ a
[~ this]
::
%test
=/ whoms (ships-to-whom (sy ~zod ~bus ~marzod ~binzod ~))
=/ ships (whom-to-ships whoms)
~& whoms
~& ships
[~ this]
::
%print-bowl
~& bol
[~ this]
::
%update-tile
[make-tile-moves this]
::
%flush-state
[~ this(sat *state)]
::
%print-state
~& sat
@ -345,7 +337,7 @@
::
=/ old=(unit collection) (~(get by pubs.sat) col.del)
?~ old
~|([%cant-delete-nonexistent-blog who.del col.del] !!)
[~ da-this]
=. pubs.sat (~(del by pubs.sat) col.del)
:- ~(tap in ~(key by pos.u.old))
(da-emil (affection del))
@ -353,10 +345,10 @@
::
=/ old=(unit collection) (~(get by subs.sat) who.del col.del)
?~ old
~|([%cant-delete-nonexistent-blog who.del col.del] !!)
[~ da-this]
=. subs.sat (~(del by subs.sat) who.del col.del)
:- ~(tap in ~(key by pos.u.old))
(da-emit [ost.bol %pull /collection/[col.del] [who.del %write] ~])
(da-emit [ost.bol %pull /collection/[col.del] [who.del %publish] ~])
:: iterate through post ids collected before, removing each from
:: secondary indices in state
::
@ -376,9 +368,9 @@
(~(get by pubs.sat) col.del)
(~(get by subs.sat) who.del col.del)
?~ old
~|([%cant-delete-nonexistent-blog who.del col.del] !!)
da-this
?. (~(has in ~(key by pos.u.old)) u.pos.del)
~|([%cant-delete-nonexistent-post who.del col.del pos.del] !!)
da-this
=/ new=collection
%= u.old
pos (~(del by pos.u.old) u.pos.del)
@ -421,25 +413,29 @@
?~ col
da-this
=/ new=collection u.col
=/ pin-ids=(list @) (fand [post]~ pin.order.u.col)
=. pin.order.u.col
=/ pin-ids=(list @) (fand [post]~ pin.order.new)
=. pin.order.new
|-
?~ pin-ids
pin.order.u.col
pin.order.new
%= $
pin.order.u.col (oust [i.pin-ids 1] pin.order.u.col)
pin.order.new (oust [i.pin-ids 1] pin.order.new)
pin-ids t.pin-ids
==
::
=/ unpin-ids=(list @) (fand [post]~ unpin.order.u.col)
=. unpin.order.u.col
=/ unpin-ids=(list @) (fand [post]~ unpin.order.new)
=. unpin.order.new
|-
?~ unpin-ids
unpin.order.u.col
unpin.order.new
%= $
unpin.order.u.col (oust [i.unpin-ids 1] unpin.order.u.col)
unpin.order.new (oust [i.unpin-ids 1] unpin.order.new)
unpin-ids t.unpin-ids
==
=? pubs.sat =(who our.bol)
(~(put by pubs.sat) coll new)
=? subs.sat !=(who our.bol)
(~(put by subs.sat) [who coll] new)
(da-emil make-tile-moves)
::
++ da-remove
@ -462,14 +458,14 @@
++ da-insert-latest
|= [who=@p coll=@tas post=@tas]
^+ da-this
=/ new-date=@da date-created:(need (get-post-by-index who coll post))
=/ new-date=@da date-created:(need (get-post-info-by-index who coll post))
=/ pre=(list [@p @tas @tas]) ~
=/ suf=(list [@p @tas @tas]) latest.sat
=? latest.sat =(~ (find [who coll post]~ latest.sat))
|-
?~ suf
(weld pre [who coll post]~)
=/ i-date=@da date-created:(need (get-post-by-index i.suf))
=/ i-date=@da date-created:(need (get-post-info-by-index i.suf))
?: (gte new-date i-date)
(weld pre [[who coll post] suf])
%= $
@ -481,7 +477,7 @@
++ da-insert-order
|= [who=@p coll=@tas post=@tas]
^+ da-this
=/ new-post=post-info (need (get-post-by-index who coll post))
=/ new-post=post-info (need (get-post-info-by-index who coll post))
=/ col=collection (need (get-coll-by-index who coll))
::
=/ pre=(list @tas) ~
@ -498,7 +494,7 @@
(snoc pre post)
?: =(post i.suf)
(weld pre suf)
=/ i-date=@da date-created:(need (get-post-by-index who coll i.suf))
=/ i-date=@da date-created:(need (get-post-info-by-index who coll i.suf))
?: (gte date-created.new-post i-date)
(weld pre [post suf])
%= $
@ -543,7 +539,7 @@
=/ rum=(unit rumor) (feel p del)
?~ rum
~
[b %diff %write-rumor u.rum]~
[b %diff %publish-rumor u.rum]~
:: +feel: delta to rumor
::
++ feel
@ -563,6 +559,19 @@
==
::
++ get-post-by-index
|= [who=@p coll=@tas post=@tas]
^- (unit (each [post-info manx @t] tang))
=/ col=(unit collection)
?: =(our.bol who)
(~(get by pubs.sat) coll)
(~(get by subs.sat) who coll)
?~ col ~
=/ pos=(unit [bone (each [post-info manx @t] tang)])
(~(get by pos.u.col) post)
?~ pos ~
[~ +.u.pos]
::
++ get-post-info-by-index
|= [who=@p coll=@tas post=@tas]
^- (unit post-info)
=/ col=(unit collection)
@ -599,7 +608,7 @@
?: ?=([%error *] build-result.mad)
[%.n message.build-result.mad]
?> ?=(%bake +<.build-result.mad)
?> ?=(%write-info p.cage.build-result.mad)
?> ?=(%publish-info p.cage.build-result.mad)
[%.y (collection-info q.q.cage.build-result.mad)]
::
?~ awa
@ -667,7 +676,7 @@
?: ?=([%error *] build-result.mad)
[%.n message.build-result.mad]
?> ?=(%bake +<.build-result.mad)
?> ?=(%write-post p.cage.build-result.mad)
?> ?=(%publish-post p.cage.build-result.mad)
[%.y (,[post-info manx @t] q.q.cage.build-result.mad)]
::
?~ awa
@ -735,7 +744,7 @@
?: ?=([%error *] build-result.mad)
[%.n message.build-result.mad]
?> ?=(%bake +<.build-result.mad)
?> ?=(%write-comments p.cage.build-result.mad)
?> ?=(%publish-comments p.cage.build-result.mad)
[%.y (,(list [comment-info @t]) q.q.cage.build-result.mad)]
::
?~ awa
@ -820,8 +829,8 @@
^- (list move)
=/ files=(list path)
?~ post
.^((list path) %ct (weld our-beak /web/write/[coll]))
.^((list path) %ct (weld our-beak /web/write/[coll]/[u.post]))
.^((list path) %ct (weld our-beak /web/publish/[coll]))
.^((list path) %ct (weld our-beak /web/publish/[coll]/[u.post]))
%+ turn files
|= pax=path
^- move
@ -835,7 +844,7 @@
%- (slog u.err)
[~ this]
::
++ poke-write-action
++ poke-publish-action
|= act=action
^- (quip move _this)
?- -.act
@ -857,27 +866,27 @@
now.bol
now.bol
==
=/ pax=path /web/write/[name.act]/write-info
=/ pax=path /web/publish/[name.act]/publish-info
=/ blog-perms=card
:* %perm /perms q.byk.bol
/web/write/[name.act]
/web/publish/[name.act]
%rw `read.perm.act `write.perm.act
==
=/ info-perms=card
:* %perm /perms q.byk.bol
/web/write/[name.act]/write-info
/web/publish/[name.act]/publish-info
%rw `*rule:clay `*rule:clay
==
::
=/ wir=wire /collection/[name.act]
=/ schema=schematic:ford
:* %bake
%write-info
%publish-info
*coin
[[our.bol q.byk.bol] /[name.act]/write/web]
[[our.bol q.byk.bol] /[name.act]/publish/web]
==
:_ this
:~ (write-file pax %write-info !>(conf))
:~ (write-file pax %publish-info !>(conf))
[ost.bol blog-perms]
[ost.bol info-perms]
[ost.bol %build wir %.y schema]
@ -886,8 +895,8 @@
%new-post
?. =(who.act our.bol)
:_ this
[ost.bol %poke /forward [who.act %write] %write-action act]~
=/ pax=path /web/write/[coll.act]/[name.act]/udon
[ost.bol %poke /forward [who.act %publish] %publish-action act]~
=/ pax=path /web/publish/[coll.act]/[name.act]/udon
?. (allowed src.bol %write pax)
[~ this]
=/ col=(unit collection) (~(get by pubs.sat) coll.act)
@ -912,27 +921,27 @@
=/ post-wir=wire /post/[coll.act]/[name.act]
=/ post-schema=schematic:ford
:* %bake
%write-post
%publish-post
*coin
[[our.bol q.byk.bol] /[name.act]/[coll.act]/write/web]
[[our.bol q.byk.bol] /[name.act]/[coll.act]/publish/web]
==
::
=/ comments-wir=wire /comments/[coll.act]/[name.act]
=/ comments-schema=schematic:ford
:* %bake
%write-comments
%publish-comments
*coin
[[our.bol q.byk.bol] /[name.act]/[coll.act]/write/web]
[[our.bol q.byk.bol] /[name.act]/[coll.act]/publish/web]
==
::
=/ post-perms=card
:* %perm /perms q.byk.bol
/web/write/[coll.act]/[name.act]/udon
/web/publish/[coll.act]/[name.act]/udon
%w `[%white (ships-to-whom (sy src.bol ~))]
==
=/ comment-perms=card
:* %perm /perms q.byk.bol
/web/write/[coll.act]/[name.act]
/web/publish/[coll.act]/[name.act]
%w `[%black ~]
==
:_ this
@ -946,8 +955,9 @@
%new-comment
?. =(who.act our.bol)
:_ this
[ost.bol %poke /forward [who.act %write] %write-action act]~
=/ pax=path /web/write/[coll.act]/[post.act]/(scot %da now.bol)/udon
[ost.bol %poke /forward [who.act %publish] %publish-action act]~
=/ pax=path
/web/publish/[coll.act]/[post.act]/(scot %da now.bol)/publish-comment
?. (allowed src.bol %write pax)
[~ this]
=/ col=(unit collection) (~(get by pubs.sat) coll.act)
@ -955,17 +965,9 @@
[~ this]
?. (~(has by pos.u.col) post.act)
[~ this]
::
=. content.act (cat 3 content.act '\0a') :: XX fix udon parser
=/ front=(map knot cord)
%- my
:~ [%creator (scot %p src.bol)]
[%collection coll.act]
[%post post.act]
[%date-created (scot %da now.bol)]
[%last-modified (scot %da now.bol)]
==
=/ out=@t (update-udon-front front content.act)
=/ com=comment
[[src.bol coll.act post.act now.bol now.bol] content.act]
::
=/ comment-perms=card
:* %perm /perms q.byk.bol pax
@ -973,7 +975,7 @@
==
::
:_ this
:~ (write-file pax %udon !>(out))
:~ (write-file pax %publish-comment !>(com))
[ost.bol comment-perms]
==
::
@ -1016,7 +1018,7 @@
?. =(src.bol our.bol)
[~ this]
:_ this
[(delete-file /web/write/[coll.act]/[post.act]/[comment.act]/udon)]~
[(delete-file /web/publish/[coll.act]/[post.act]/[comment.act]/udon)]~
::
%edit-collection
?. =(src.bol our.bol)
@ -1026,9 +1028,9 @@
%edit-post
?. =(who.act our.bol)
:_ this
[ost.bol %poke /forward [who.act %write] %write-action act]~
[ost.bol %poke /forward [who.act %publish] %publish-action act]~
::
=/ pax=path /web/write/[coll.act]/[name.act]/udon
=/ pax=path /web/publish/[coll.act]/[name.act]/udon
?. (allowed src.bol %write pax)
[~ this]
=/ col=(unit collection) (~(get by pubs.sat) coll.act)
@ -1037,9 +1039,14 @@
?. (~(has by pos.u.col) name.act)
[~ this]
::
=/ pos=(unit post-info) (get-post-by-index who.act coll.act name.act)
=/ pos=(unit (each [post-info manx @t] tang))
(get-post-by-index who.act coll.act name.act)
?~ pos
~| %editing-non-existent-post !!
=/ date-created=@da
?: ?=(%.y -.u.pos)
date-created.-.p.u.pos
now.bol
::
=. content.act (cat 3 content.act '\0a') :: XX fix udon parser
=/ front=(map knot cord)
@ -1049,9 +1056,9 @@
[%collection coll.act]
[%filename name.act]
[%comments com.act]
[%date-created (scot %da date-created.u.pos)]
[%date-created (scot %da date-created)]
[%last-modified (scot %da now.bol)]
[%pinned ?:(pinned.u.pos %true %false)]
[%pinned %false]
==
=/ out=@t (update-udon-front front content.act)
::
@ -1068,14 +1075,14 @@
%+ turn who.act
|= who=@p
^- move
[ost.bol %poke /forward [who %write] %write-action new-act]
[ost.bol %poke /forward [who %publish] %publish-action new-act]
=. invites.sat (~(put by invites.sat) [src.bol coll.act] title.act)
:_ this
%+ welp make-tile-moves
::
%+ turn (prey:pubsub:userlib /primary bol)
|= [b=bone *]
[b %diff %write-update %invite %.y src.bol coll.act title.act]
[b %diff %publish-update %invite %.y src.bol coll.act title.act]
::
:: %reject-invite: remove invite from list, acceptance is handled by
:: %subscribe action
@ -1091,7 +1098,7 @@
%+ turn (prey:pubsub:userlib /primary bol)
|= [b=bone *]
^- move
[b %diff %write-update %invite %.n who.act coll.act u.title]
[b %diff %publish-update %invite %.n who.act coll.act u.title]
::
:: %serve:
::
@ -1100,44 +1107,44 @@
?: (~(has by pubs.sat) coll.act)
[~ this]
=/ files=(list path)
.^((list path) %ct (weld our-beak /web/write/[coll.act]))
.^((list path) %ct (weld our-beak /web/publish/[coll.act]))
=/ all=[moves=(list move) builds=(set wire)]
%+ roll files
|= [pax=path out=[moves=(list move) builds=(set wire)]]
?+ pax
out
::
[%web %write @tas %write-info ~]
[%web %publish @tas %publish-info ~]
?> =(coll.act i.t.t.pax)
=/ wir=wire /collection/[coll.act]
=/ schema=schematic:ford
:* %bake
%write-info
%publish-info
*coin
[[our.bol q.byk.bol] /[coll.act]/write/web]
[[our.bol q.byk.bol] /[coll.act]/publish/web]
==
%= out
moves [[ost.bol %build wir %.y schema] moves.out]
builds (~(put in builds.out) wir)
==
::
[%web %write @tas @tas %udon ~]
[%web %publish @tas @tas %udon ~]
?> =(coll.act i.t.t.pax)
=/ post i.t.t.t.pax
=/ post-wir=wire /post/[coll.act]/[post]
=/ post-schema=schematic:ford
:* %bake
%write-post
%publish-post
*coin
[[our.bol q.byk.bol] /[post]/[coll.act]/write/web]
[[our.bol q.byk.bol] /[post]/[coll.act]/publish/web]
==
::
=/ comments-wir=wire /comments/[coll.act]/[post]
=/ comments-schema=schematic:ford
:* %bake
%write-comments
%publish-comments
*coin
[[our.bol q.byk.bol] /[post]/[coll.act]/write/web]
[[our.bol q.byk.bol] /[post]/[coll.act]/publish/web]
==
%= out
moves
@ -1186,12 +1193,12 @@
:_ this(outgoing.sat (~(put by outgoing.sat) wir ost.bol))
;: welp
make-tile-moves
[ost.bol %peer wir [who.act %write] wir]~
[ost.bol %peer wir [who.act %publish] wir]~
?~ title ~
%+ turn (prey:pubsub:userlib /primary bol)
|= [b=bone *]
^- move
[b %diff %write-update %invite %.n who.act coll.act u.title]
[b %diff %publish-update %invite %.n who.act coll.act u.title]
==
::
:: %unsubscribe: unsub from a foreign blog, delete all state related to it
@ -1221,12 +1228,12 @@
latest.sat new-latest
outgoing.sat (~(del by outgoing.sat) wir)
==
:- [u.bon %pull wir [who.act %write] ~]
:- [u.bon %pull wir [who.act %publish] ~]
%+ welp make-tile-moves
%+ turn (prey:pubsub:userlib /primary bol)
|= [b=bone *]
^- move
[b %diff %write-rumor %remove who.act coll.act ~]
[b %diff %publish-rumor %remove who.act coll.act ~]
::
:: %read: notify that we've seen a post
::
@ -1301,27 +1308,15 @@
=/ hym=manx (index (state-to-json sat))
:_ this
[ost.bol %http-response (manx-response:app hym)]~
:: new
::
[[~ [%'~publish' @t @t %new ~]] ~]
=/ hym=manx (index (state-to-json sat))
:_ this
[ost.bol %http-response (manx-response:app hym)]~
:: new
::
[[~ [%'~publish' %new ~]] ~]
=/ hym=manx (index (state-to-json sat))
:_ this
[ost.bol %http-response (manx-response:app hym)]~
:: new post
::
[[~ [%'~publish' %new %post ~]] ~]
[[~ [%'~publish' %new-post ~]] ~]
=/ hym=manx (index (state-to-json sat))
:_ this
[ost.bol %http-response (manx-response:app hym)]~
:: new blog
::
[[~ [%'~publish' %new %blog ~]] ~]
[[~ [%'~publish' %new-blog ~]] ~]
=/ hym=manx (index (state-to-json sat))
:_ this
[ost.bol %http-response (manx-response:app hym)]~
@ -1340,14 +1335,6 @@
=/ blog=@tas i.t.t.site.request-line
=/ post=@tas i.t.t.t.site.request-line
::
:: ?~ who [[ost.bol %http-response not-found:app]~ this]
:: =/ col=(unit collection)
:: ?: =(u.who our.bol)
:: (~(get by pubs.sat) blog)
:: (~(get by subs.sat) u.who blog)
:: ?~ col [[ost.bol %http-response not-found:app]~ this]
:: =/ pos (~(get by pos.u.col) post)
:: ?~ pos [[ost.bol %http-response not-found:app]~ this]
=/ hym=manx (index (state-to-json sat))
:_ this
[ost.bol %http-response (manx-response:app hym)]~
@ -1407,7 +1394,7 @@
?. ?=([@tas ~] wir)
[~ this]
=/ coll=@tas i.wir
=/ pax /web/write/[coll]
=/ pax /web/publish/[coll]
?. (allowed src.bol %read pax)
:_ this
[ost.bol %quit ~]~
@ -1421,13 +1408,12 @@
=/ rum=rumor
[%total our.bol coll new]
:_ this(pubs.sat (~(put by pubs.sat) coll new))
[ost.bol %diff %write-rumor rum]~
[ost.bol %diff %publish-rumor rum]~
::
++ diff-write-rumor
++ diff-publish-rumor
|= [wir=wire rum=rumor]
^- (quip move _this)
(bake rum)
::
:: +poke-handle-http-cancel: received when a connection was killed
::
++ poke-handle-http-cancel

File diff suppressed because one or more lines are too long

View File

Before

Width:  |  Height:  |  Size: 245 B

After

Width:  |  Height:  |  Size: 245 B

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -3,7 +3,7 @@
;html
::
;head
;title: Write
;title: Publish
;meta(charset "utf-8");
;meta
=name "viewport"

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -94,7 +94,7 @@
[%home %modulo]
[%home %launch]
[%home %chat]
[%home %write]
[%home %publish]
[%home %timer]
[%home %clock]
[%home %weather]

View File

@ -1,4 +1,4 @@
/- *write
/- *publish
/+ elem-to-react-json
|%
::

View File

@ -1,11 +1,11 @@
::
:::: /hoon/action/write/mar
:::: /hoon/action/publish/mar
::
/? 309
/- write
/- publish
=, format
::
|_ act=action:write
|_ act=action:publish
::
++ grow
|%
@ -14,10 +14,10 @@
::
++ grab
|%
++ noun action:write
++ noun action:publish
++ json
|= jon=^json
%- action:write
%- action:publish
=< (action jon)
|%
++ action

View File

@ -0,0 +1,68 @@
/- publish
!:
|_ com=comment:publish
::
::
++ grow
|%
++ mime
:- /text/x-publish-comments
(as-octs:mimes:html (of-wain:format txt))
++ txt
^- wain
:* (cat 3 'creator: ' (scot %p creator.info.com))
(cat 3 'collection: ' collection.info.com)
(cat 3 'post: ' post.info.com)
(cat 3 'date-created: ' (scot %da date-created.info.com))
(cat 3 'last-modified: ' (scot %da last-modified.info.com))
'-----'
(to-wain:format body.com)
==
--
++ grab
|%
++ mime
|= [mite:eyre p=octs:eyre]
(txt (to-wain:format q.p))
++ txt
|= txs=(pole @t)
^- comment:publish
:: TODO: putting ~ instead of * breaks this but shouldn't
::
?> ?= $: creator=@t
collection=@t
post=@t
date-created=@t
last-modified=@t
line=@t
body=*
==
txs
:_ (of-wain:format (wain body.txs))
::
:* %+ rash creator.txs
;~(pfix (jest 'creator: ~') fed:ag)
::
%+ rash collection.txs
;~(pfix (jest 'collection: ') (cook crip (star next)))
::
%+ rash post.txs
;~(pfix (jest 'post: ') (cook crip (star next)))
::
%+ rash date-created.txs
;~ pfix
(jest 'date-created: ~')
(cook year when:so)
==
::
%+ rash last-modified.txs
;~ pfix
(jest 'last-modified: ~')
(cook year when:so)
==
::
==
++ noun comment:publish
--
++ grad %mime
--

View File

@ -1,15 +1,15 @@
::
:::: /hoon/info/write/mar
:::: /hoon/info/publish/mar
::
/- write
/- publish
!:
|_ con=collection-info:write
|_ con=collection-info:publish
::
::
++ grow
|%
++ mime
:- /text/x-write-info
:- /text/x-publish-info
(as-octs:mimes:html (of-wain:format txt))
++ txt
^- wain
@ -29,7 +29,7 @@
(txt (to-wain:format q.p))
++ txt
|= txs=(pole @t)
^- collection-info:write
^- collection-info:publish
:: TODO: putting ~ instead of * breaks this but shouldn't
::
?> ?= $: owner=@t
@ -55,14 +55,14 @@
%+ rash comments.txs
;~ pfix
(jest 'comments: ')
%+ cook comment-config:write
%+ cook comment-config:publish
;~(pose (jest %open) (jest %closed) (jest %none))
==
::
%+ rash allow-edit.txs
;~ pfix
(jest 'allow-edit: ')
%+ cook edit-config:write
%+ cook edit-config:publish
;~(pose (jest %post) (jest %comment) (jest %all) (jest %none))
==
::
@ -78,7 +78,7 @@
(cook year when:so)
==
==
++ noun collection-info:write
++ noun collection-info:publish
--
++ grad %mime
--

View File

@ -1,5 +1,5 @@
/- *write
/+ *write, elem-to-react-json
/- *publish
/+ *publish
|_ rum=rumor
++ grab
|%

View File

@ -1,4 +1,4 @@
/- *write
/- *publish
|_ upd=update
++ grab
|%

View File

@ -1,12 +0,0 @@
::
:::: /hoon/paste/write/mar
::
/? 310
|_ [typ=?($hoon $md $txt) txt=@t]
++ grab
|%
++ noun [?($hoon $md $txt) @t]
++ json
(corl need =>(dejs-soft:format (ot typ+(ci (soft ?($hoon $md $txt)) so) txt+so ~)))
--
--

View File

@ -1,12 +0,0 @@
::
:::: /hoon/paste/write/mar
::
/? 310
|_ [who=@txname loc=@txloc]
++ grab
|%
++ noun [@txname @txloc]
++ json
(corl need =>(dejs-soft:format (ot who+so loc+so ~)))
--
--

View File

@ -1,15 +0,0 @@
::
:::: /hoon/tree/write/mar
::
/? 310
::
=, mimes:html
=, format
|_ [sup=spur mim=mime]
++ grab
|%
++ noun [spur mime]
++ json
=,(dejs (ot sup+(su fel:stab) mime+(cu |=(a=@t [/ (as-octs a)]) so) ~))
--
--

View File

@ -1,11 +0,0 @@
::
:::: /hoon/wipe/write/mar
::
/? 310
|_ spur
++ grab
|%
++ noun spur
++ json (corl need (su:dejs-soft:format fel:stab))
--
--

View File

@ -0,0 +1,14 @@
/- publish
/+ publish
/= result
/^ (list comment:publish)
/;
|= comments=(map knot comment:publish)
^- (list [comment-info:publish @t])
%+ sort ~(val by comments)
|= [a=comment:publish b=comment:publish]
^- ?
(lte date-created.info.a date-created.info.b)
::
/_ /publish-comment/
result

View File

@ -1,15 +1,15 @@
/- write
/+ write, cram, elem-to-react-json
/- publish
/+ publish, cram, elem-to-react-json
/= args /$ ,[beam *]
/= result
/^ [post-info:write manx @t]
/^ [post-info:publish manx @t]
/;
|= $: post-front=(map knot cord)
post-content=manx
post-raw=wain
~
==
:+ (front-to-post-info:write post-front)
:+ (front-to-post-info:publish post-front)
post-content
(of-wain:format (slag 11 post-raw))
::

View File

@ -1,27 +0,0 @@
/- write
/+ write, cram, elem-to-react-json
/= args /$ ,[beam *]
/= result
/^ (list [comment-info:write @t])
/;
|= $= comments
%+ map knot
$: comment-front=(map knot cord)
comment-content=wain
~
==
^- (list [comment-info:write @t])
%+ sort
%+ turn ~(tap by comments)
|= [fil=knot front=(map knot cord) content=wain ~]
^- [comment-info:write @t]
:- (front-to-comment-info:write front)
(of-wain:format (slag 8 content))
|= [a=[com=comment-info:write @t] b=[com=comment-info:write @t]]
(lte date-created.com.a date-created.com.b)
::
/_
/. /&front&/udon/
/&txt&/udon/
==
result

View File

@ -84,6 +84,8 @@
last-modified=@da
==
::
+$ comment [info=comment-info body=@t]
::
+$ perm-config [read=rule:clay write=rule:clay]
::
+$ comment-config $?(%open %closed %none)
@ -115,7 +117,7 @@
+$ delta
$% [%collection who=@p col=@tas dat=(each collection-info tang)]
[%post who=@p col=@tas pos=@tas dat=(each [post-info manx @t] tang)]
[%comments who=@p col=@tas pos=@tas dat=(each (list [comment-info @t]) tang)]
[%comments who=@p col=@tas pos=@tas dat=(each (list comment) tang)]
[%total who=@p col=@tas dat=collection]
[%remove who=@p col=@tas pos=(unit @tas)]
==

View File

@ -26,3 +26,5 @@ GTAGS
*.swp
hash_tests
hashtable_tests
mug_tests
jam_tests