mirror of
https://github.com/urbit/shrub.git
synced 2024-12-15 04:22:48 +03:00
track invites, contributors, subscribers on backend; make comments plaintext
This commit is contained in:
parent
2210236262
commit
8a0447b135
@ -61,6 +61,17 @@
|
||||
:: +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)
|
||||
::
|
||||
::
|
||||
++ allowed
|
||||
|= [who=@p mod=?(%read %write) pax=path]
|
||||
^- ?
|
||||
=. pax (weld our-beak pax)
|
||||
=/ pem=[dict:clay dict:clay] .^([dict:clay dict:clay] %cp pax)
|
||||
?- mod
|
||||
%read (allowed-by who -.pem)
|
||||
%write (allowed-by who +.pem)
|
||||
==
|
||||
:: +allowed-by: checks if ship :who is allowed by the permission rules in :dic
|
||||
::
|
||||
++ allowed-by
|
||||
@ -229,8 +240,8 @@
|
||||
(~(get by subs.sat) who.del col.del)
|
||||
=/ new=collection
|
||||
?~ old
|
||||
[dat.del ~ ~ ~ ~]
|
||||
[dat.del pos.u.old com.u.old order.u.old]
|
||||
[dat.del ~ ~ [~ ~] ~ ~]
|
||||
u.old(col dat.del)
|
||||
=? pubs.sat =(our.bol who.del)
|
||||
(~(put by pubs.sat) col.del new)
|
||||
=? subs.sat !=(our.bol who.del)
|
||||
@ -244,8 +255,8 @@
|
||||
(~(get by subs.sat) who.del col.del)
|
||||
=/ new=collection
|
||||
?~ old
|
||||
[[%.n ~] (my [pos.del dat.del] ~) ~ ~ ~]
|
||||
[col.u.old (~(put by pos.u.old) pos.del dat.del) com.u.old order.u.old]
|
||||
[[%.n ~] (my [pos.del dat.del] ~) ~ [~ ~] ~ ~]
|
||||
u.old(pos (~(put by pos.u.old) pos.del dat.del))
|
||||
=? pubs.sat =(our.bol who.del)
|
||||
(~(put by pubs.sat) col.del new)
|
||||
=? subs.sat !=(our.bol who.del)
|
||||
@ -261,8 +272,8 @@
|
||||
(~(get by subs.sat) who.del col.del)
|
||||
=/ new=collection
|
||||
?~ old
|
||||
[[%.n ~] ~ (my [pos.del dat.del] ~) ~ ~]
|
||||
[col.u.old pos.u.old (~(put by com.u.old) pos.del dat.del) order.u.old]
|
||||
[[%.n ~] ~ (my [pos.del dat.del] ~) [~ ~] ~ ~]
|
||||
u.old(com (~(put by com.u.old) pos.del dat.del))
|
||||
=? pubs.sat =(our.bol who.del)
|
||||
(~(put by pubs.sat) col.del new)
|
||||
=? subs.sat !=(our.bol who.del)
|
||||
@ -285,6 +296,9 @@
|
||||
posts t.posts
|
||||
==
|
||||
(da-emil (affection del))
|
||||
::
|
||||
%remove
|
||||
da-this
|
||||
::
|
||||
==
|
||||
::
|
||||
@ -454,7 +468,7 @@
|
||||
(bake [%collection our.bol col dat])
|
||||
:: 1st part of multi-part, store partial delta and don't process it
|
||||
::
|
||||
=/ del=delta [%total our.bol col dat ~ ~ ~ ~]
|
||||
=/ del=delta [%total our.bol col dat ~ ~ [~ ~] ~ ~]
|
||||
=. awaiting.sat (~(put by awaiting.sat) col builds.u.awa `del)
|
||||
[~ this]
|
||||
::
|
||||
@ -470,6 +484,8 @@
|
||||
pos.dat.u.partial.u.awa
|
||||
com.dat.u.partial.u.awa
|
||||
[~ ~]
|
||||
~
|
||||
~
|
||||
==
|
||||
=. awaiting.sat (~(del by awaiting.sat) col)
|
||||
(bake del)
|
||||
@ -484,6 +500,8 @@
|
||||
pos.dat.u.partial.u.awa
|
||||
com.dat.u.partial.u.awa
|
||||
[~ ~]
|
||||
~
|
||||
~
|
||||
==
|
||||
=. awaiting.sat (~(put by awaiting.sat) col builds.u.awa `del)
|
||||
[~ this]
|
||||
@ -513,7 +531,8 @@
|
||||
(bake [%post our.bol col pos dat])
|
||||
:: 1st part of multi-part, store partial delta and don't process it
|
||||
::
|
||||
=/ del=delta [%total our.bol col [%.n ~] (my [pos dat] ~) ~ ~ ~]
|
||||
=/ del=delta
|
||||
[%total our.bol col [%.n ~] (my [pos dat] ~) ~ [~ ~] ~ ~]
|
||||
=. awaiting.sat (~(put by awaiting.sat) col builds.u.awa `del)
|
||||
[~ this]
|
||||
::
|
||||
@ -529,6 +548,8 @@
|
||||
(~(put by pos.dat.u.partial.u.awa) pos dat)
|
||||
com.dat.u.partial.u.awa
|
||||
[~ ~]
|
||||
~
|
||||
~
|
||||
==
|
||||
=. awaiting.sat (~(del by awaiting.sat) col)
|
||||
(bake del)
|
||||
@ -543,6 +564,8 @@
|
||||
(~(put by pos.dat.u.partial.u.awa) pos dat)
|
||||
com.dat.u.partial.u.awa
|
||||
[~ ~]
|
||||
~
|
||||
~
|
||||
==
|
||||
=. awaiting.sat (~(put by awaiting.sat) col builds.u.awa `del)
|
||||
[~ this]
|
||||
@ -552,14 +575,14 @@
|
||||
=/ pos=@tas i.t.t.wir
|
||||
=/ awa (~(get by awaiting.sat) col)
|
||||
::
|
||||
=/ dat=(each (list [comment-info manx]) tang)
|
||||
=/ dat=(each (list [comment-info @t]) tang)
|
||||
?: ?=([%incomplete *] mad)
|
||||
[%.n tang.mad]
|
||||
?: ?=([%error *] build-result.mad)
|
||||
[%.n message.build-result.mad]
|
||||
?> ?=(%bake +<.build-result.mad)
|
||||
?> ?=(%write-comments p.cage.build-result.mad)
|
||||
[%.y (,(list [comment-info manx]) q.q.cage.build-result.mad)]
|
||||
[%.y (,(list [comment-info @t]) q.q.cage.build-result.mad)]
|
||||
::
|
||||
?~ awa
|
||||
(bake [%comments our.bol col pos dat])
|
||||
@ -572,7 +595,8 @@
|
||||
(bake [%comments our.bol col pos dat])
|
||||
:: 1st part of multi-part, store partial delta and don't process it
|
||||
::
|
||||
=/ del=delta [%total our.bol col [%.n ~] ~ (my [pos dat] ~) ~ ~]
|
||||
=/ del=delta
|
||||
[%total our.bol col [%.n ~] ~ (my [pos dat] ~) [~ ~] ~ ~]
|
||||
=. awaiting.sat (~(put by awaiting.sat) col builds.u.awa `del)
|
||||
[~ this]
|
||||
::
|
||||
@ -588,6 +612,8 @@
|
||||
pos.dat.u.partial.u.awa
|
||||
(~(put by com.dat.u.partial.u.awa) pos dat)
|
||||
[~ ~]
|
||||
~
|
||||
~
|
||||
==
|
||||
=. awaiting.sat (~(del by awaiting.sat) col)
|
||||
(bake del)
|
||||
@ -602,6 +628,8 @@
|
||||
pos.dat.u.partial.u.awa
|
||||
(~(put by com.dat.u.partial.u.awa) pos dat)
|
||||
[~ ~]
|
||||
~
|
||||
~
|
||||
==
|
||||
=. awaiting.sat (~(put by awaiting.sat) col builds.u.awa `del)
|
||||
[~ this]
|
||||
@ -708,7 +736,13 @@
|
||||
:_ this
|
||||
[(write-file pax %udon !>(out))]~
|
||||
::
|
||||
%delete
|
||||
%delete-collection
|
||||
[~ this]
|
||||
::
|
||||
%delete-post
|
||||
[~ this]
|
||||
::
|
||||
%delete-comment
|
||||
[~ this]
|
||||
::
|
||||
%edit-collection
|
||||
@ -744,11 +778,26 @@
|
||||
:_ this
|
||||
[(write-file pax %udon !>(out))]~
|
||||
::
|
||||
%edit-comment
|
||||
[~ this]
|
||||
:: %invite: if the action is from us it means send invites to other people
|
||||
:: if its from someone else it means we've been invited
|
||||
::
|
||||
%invite
|
||||
[~ this]
|
||||
?: =(our.bol src.bol)
|
||||
=/ new-act=action [%invite coll.act title.act ~]
|
||||
:_ this
|
||||
%+ turn who.act
|
||||
|= who=@p
|
||||
^- move
|
||||
[ost.bol %poke /forward [who %write] %write-action new-act]
|
||||
:- ~
|
||||
this(invites.sat (~(put by invites.sat) [src.bol coll.act] title.act))
|
||||
::
|
||||
:: %reject-invite: remove invite from list, acceptance is handled by
|
||||
:: %subscribe action
|
||||
::
|
||||
%reject-invite
|
||||
:- ~
|
||||
this(invites.sat (~(del by invites.sat) [who.act coll.act]))
|
||||
::
|
||||
:: %serve:
|
||||
::
|
||||
@ -852,15 +901,15 @@
|
||||
unread.sat new-unread
|
||||
==
|
||||
::
|
||||
:: %subscribe:
|
||||
:: %subscribe: sub to a foreign blog; remove invites for that blog
|
||||
::
|
||||
%subscribe
|
||||
~& write-action+act
|
||||
=/ wir=wire /collection/[coll.act]
|
||||
:_ this
|
||||
:_ this(invites.sat (~(del by invites.sat) [who.act coll.act]))
|
||||
[ost.bol %peer wir [who.act %write] wir]~
|
||||
::
|
||||
:: %unsubscribe:
|
||||
:: %unsubscribe: unsub from a foreign blog, delete all state related to it
|
||||
::
|
||||
%unsubscribe
|
||||
=/ new-latest=(list [@p @tas @tas])
|
||||
|
@ -108,16 +108,16 @@
|
||||
(tang-to-json +.bud)
|
||||
::
|
||||
++ comment-build-to-json
|
||||
|= bud=(each (list [comment-info manx]) tang)
|
||||
|= bud=(each (list [comment-info @t]) tang)
|
||||
^- json
|
||||
?: ?=(%.y -.bud)
|
||||
:- %a
|
||||
%+ turn p.bud
|
||||
|= [com=comment-info man=manx]
|
||||
|= [com=comment-info bod=@t]
|
||||
^- json
|
||||
%- pairs:enjs:format
|
||||
:~ info+(comment-info-to-json com)
|
||||
body+(elem-to-react-json man)
|
||||
body+s+bod
|
||||
==
|
||||
(tang-to-json +.bud)
|
||||
::
|
||||
@ -146,7 +146,19 @@
|
||||
:~ pin+a+(turn pin.order.col |=(s=@tas [%s s]))
|
||||
unpin+a+(turn unpin.order.col |=(s=@tas [%s s]))
|
||||
==
|
||||
|
||||
::
|
||||
:+ %contributors
|
||||
%a
|
||||
%+ turn ~(tap in contributors.col)
|
||||
|= who=@p
|
||||
(ship:enjs:format who)
|
||||
::
|
||||
:+ %subscribers
|
||||
%a
|
||||
%+ turn ~(tap in subscribers.col)
|
||||
|= who=@p
|
||||
^- json
|
||||
(ship:enjs:format who)
|
||||
==
|
||||
::
|
||||
++ state-to-json
|
||||
@ -199,6 +211,16 @@
|
||||
coll+s+coll
|
||||
post+s+post
|
||||
==
|
||||
::
|
||||
:+ %invites
|
||||
%a
|
||||
%+ turn ~(tap in invites.sat)
|
||||
|= [[who=@p coll=@tas] title=@t]
|
||||
%- pairs:enjs:format
|
||||
:~ who+(ship:enjs:format who)
|
||||
coll+s+coll
|
||||
title+s+title
|
||||
==
|
||||
==
|
||||
::
|
||||
--
|
||||
|
@ -26,13 +26,15 @@
|
||||
new-post+new-post
|
||||
new-comment+new-comment
|
||||
::
|
||||
delete+item-id
|
||||
delete-collection+delete-collection
|
||||
delete-post+delete-post
|
||||
delete-comment+delete-comment
|
||||
::
|
||||
edit-collection+edit-collection
|
||||
edit-post+edit-post
|
||||
edit-comment+edit-comment
|
||||
::
|
||||
invite+invite
|
||||
reject-invite+reject-invite
|
||||
::
|
||||
serve+serve
|
||||
unserve+unserve
|
||||
@ -70,6 +72,21 @@
|
||||
content+so:dejs
|
||||
==
|
||||
::
|
||||
++ delete-collection (of:dejs coll+(su:dejs sym) ~)
|
||||
::
|
||||
++ delete-post
|
||||
%- ot:dejs
|
||||
coll+(su:dejs sym)
|
||||
post+(su:dejs sym)
|
||||
==
|
||||
::
|
||||
++ delete-comment
|
||||
%- ot:dejs
|
||||
coll+(su:dejs sym)
|
||||
post+(su:dejs sym)
|
||||
comment+(su:dejs sym)
|
||||
==
|
||||
::
|
||||
++ edit-collection
|
||||
%- ot:dejs
|
||||
:~ name+(su:dejs sym)
|
||||
@ -151,6 +168,12 @@
|
||||
who+(ar:dejs (su:dejs fed:ag))
|
||||
==
|
||||
::
|
||||
++ reject-invite
|
||||
%- ot:dejs
|
||||
:~ coll+(su:dejs sym)
|
||||
who+(su:dejs fed:ag)
|
||||
==
|
||||
::
|
||||
++ serve
|
||||
%- ot:dejs
|
||||
:~ coll+(su:dejs sym)
|
||||
|
@ -41,6 +41,13 @@
|
||||
[%who (ship who.rum)]
|
||||
[%data (total-build-to-json dat.rum)]
|
||||
==
|
||||
::
|
||||
%remove
|
||||
=/ suf=(list [@tas json])
|
||||
%- pairs
|
||||
:~ [%coll s+col.rum]
|
||||
[%post ?~(pos.rum ~ s+u.pos.rum)]
|
||||
==
|
||||
==
|
||||
::
|
||||
--
|
||||
|
@ -2,23 +2,24 @@
|
||||
/+ write, cram, elem-to-react-json
|
||||
/= args /$ ,[beam *]
|
||||
/= result
|
||||
/^ (list [comment-info:write manx])
|
||||
/^ (list [comment-info:write @t])
|
||||
/;
|
||||
|= $= comments
|
||||
%+ map knot
|
||||
$: comment-front=(map knot cord)
|
||||
comment-content=manx
|
||||
comment-content=wain
|
||||
~
|
||||
==
|
||||
^- (list [comment-info:write manx])
|
||||
^- (list [comment-info:write @t])
|
||||
:: XX sort this list
|
||||
%+ turn ~(tap by comments)
|
||||
|= [fil=knot front=(map knot cord) content=manx ~]
|
||||
^- [comment-info:write manx]
|
||||
[(front-to-comment-info:write front) content]
|
||||
|= [fil=knot front=(map knot cord) content=wain ~]
|
||||
^- [comment-info:write @t]
|
||||
:- (front-to-comment-info:write front)
|
||||
(of-wain:format (slag 8 content))
|
||||
::
|
||||
/_
|
||||
/. /&front&/udon/
|
||||
/&elem&/udon/
|
||||
/&txt&/udon/
|
||||
==
|
||||
result
|
||||
|
@ -1,9 +1,4 @@
|
||||
|%
|
||||
+$ item-id
|
||||
$? coll=@tas
|
||||
[coll=@tas post=@tas]
|
||||
[coll=@tas post=@tas comment=@tas]
|
||||
==
|
||||
::
|
||||
+$ action
|
||||
$% $: %new-collection
|
||||
@ -26,7 +21,9 @@
|
||||
::
|
||||
[%new-comment who=@p coll=@tas post=@tas content=@t]
|
||||
::
|
||||
[%delete item-id]
|
||||
[%delete-collection coll=@tas]
|
||||
[%delete-post coll=@tas post=@tas]
|
||||
[%delete-comment coll=@tas post=@tas comment=@tas]
|
||||
::
|
||||
$: %edit-collection
|
||||
name=@tas
|
||||
@ -46,9 +43,8 @@
|
||||
content=@t
|
||||
==
|
||||
::
|
||||
[%edit-comment coll=@tas post=@tas id=@tas content=@t]
|
||||
::
|
||||
[%invite coll=@tas who=(list ship)]
|
||||
[%invite coll=@tas title=@t who=(list ship)]
|
||||
[%reject-invite coll=@tas who=ship]
|
||||
::
|
||||
[%serve coll=@tas]
|
||||
[%unserve coll=@tas]
|
||||
@ -96,17 +92,14 @@
|
||||
+$ edit-config $?(%post %comment %all %none)
|
||||
::
|
||||
+$ rumor delta
|
||||
:: $% [%collection who=@p col=@tas dat=(each collection-info tang)]
|
||||
:: [%post who=@p col=@tas pos=@tas dat=(each [post-info manx] tang)]
|
||||
:: [%comments who=@p col=@tas pos=@tas dat=(each (list [comment-info manx]) tang)]
|
||||
:: [%serve who=@p nom=@tas col=collection]
|
||||
:: ==
|
||||
::
|
||||
+$ collection
|
||||
$: col=(each collection-info tang)
|
||||
pos=(map @tas (each [post-info manx @t] tang))
|
||||
com=(map @tas (each (list [comment-info manx]) tang))
|
||||
com=(map @tas (each (list [comment-info @t]) tang))
|
||||
order=[pin=(list @tas) unpin=(list @tas)]
|
||||
contributors=(set @p)
|
||||
subscribers=(set @p)
|
||||
==
|
||||
::
|
||||
+$ state
|
||||
@ -115,12 +108,14 @@
|
||||
awaiting=(map @tas [builds=(set wire) partial=(unit delta)])
|
||||
latest=(list [who=ship coll=@tas post=@tas])
|
||||
unread=(set [who=ship coll=@tas post=@tas])
|
||||
invites=(map [who=ship coll=@tas] title=@t)
|
||||
==
|
||||
::
|
||||
+$ 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 manx]) tang)]
|
||||
[%comments who=@p col=@tas pos=@tas dat=(each (list [comment-info @t]) tang)]
|
||||
[%total who=@p col=@tas dat=collection]
|
||||
[%remove who=@p col=@tas pos=(unit @tas)]
|
||||
==
|
||||
--
|
||||
|
Loading…
Reference in New Issue
Block a user