Merge branch 'collections-config-changes' into next-ota

This commit is contained in:
Chris Johnson 2019-01-18 13:08:00 -08:00
commit 4b4ef4195a
6 changed files with 91 additions and 88 deletions

View File

@ -4,7 +4,7 @@
/? 309
/- hall
/+ cram, elem-to-react-json
:: ::
:: ::
~% %collections-lib ..is ~
|%
+$ move [bone card]
@ -103,7 +103,7 @@
name=@t
description=@t
::
owner=@p
author=@p
::
date-created=@da
last-modified=@da
@ -259,7 +259,7 @@
[%s a]
:- %name [%s name.con]
:- %desc [%s description.con]
:- %owner (ship:enjs:format owner.con)
:- %author (ship:enjs:format author.con)
:- %date-created (time:enjs:format date-created.con)
:- %last-modified (time:enjs:format last-modified.con)
:- %type [%s type.con]
@ -339,7 +339,8 @@
|= [pax=path conf=config]
^- json
%- pairs:enjs:format
:~ ['owner' [%s (crip (scow %p owner.conf))]]
:~ ['author' [%s (crip (scow %p author.conf))]]
['host' [%s (crip (scow %p p.full-path.conf))]]
['path' [%a (turn pax |=(a=@ta `json`[%s a]))]]
['name' [%s name.conf]]
['date' [%s (crip (scow %da last-modified.conf))]]
@ -352,7 +353,8 @@
~/ %coll-item-notify
|= [pax=path raw=raw-item now=@da byk=beak]
^- json
=/ owner (fall (~(get by meta.raw) %owner) ~.anon)
=/ author (fall (~(get by meta.raw) %author) ~.anon)
=/ host (fall (~(get by meta.raw) %host) ~.anon)
=/ dat (fall (~(get by meta.raw) %last-modified) (scot %da now))
=/ nom (fall (~(get by meta.raw) %name) ~.no-title)
=/ typ (fall (~(get by meta.raw) %type) ~.no-type)
@ -360,8 +362,8 @@
=/ elm=manx elm:(static:cram (ream data.raw))
=/ snip=marl tal:(hedtal +.elm)
=/ inner
?~ snip
(crip (en-xml:html elm))
?~ snip
(crip (en-xml:html elm))
(crip (en-xml:html i.snip)) :: inner html
::
=/ parent-spur (slag 1 (flop pax))
@ -372,7 +374,7 @@
=/ parent-conf=json
?: (~(has in dir.parent-dir) ~.udon ~)
%- meta-to-json
%- udon-to-front
%- udon-to-front
.^(@t %cx (weld parent-path /udon))
?: (~(has in dir.parent-dir) ~.collections-config ~)
%- config-to-json
@ -380,7 +382,8 @@
~
::
%- pairs:enjs:format
:~ ['owner' [%s owner]]
:~ ['author' [%s author]]
['host' [%s host]]
['path' [%a (turn pax |=(a=@ta `json`[%s a]))]]
['name' [%s nom]]
['date' [%s dat]]
@ -436,8 +439,8 @@
::
++ ta-this .
::
:: +ta-done:
::
:: +ta-done:
::
:: flop :moves for finalization, since moves are prepended to the list
::
++ ta-done (flop moves)
@ -493,7 +496,7 @@
=/ perms .^([dict:clay dict:clay] %cp sap)
?: (allowed-by src.bol +.perms our.bol)
(ta-remove pax.a)
ta-this
ta-this
::
%perms
?: =(src.bol our.bol) :: XX admin privileges for other users?
@ -504,7 +507,7 @@
:: XX some of this is redunant
::
%collection
=/ perms
=/ perms
.^([dict:clay dict:clay] %cp (weld sap /[dat]/collections-config))
?. (allowed-by src.bol +.perms our.bol)
ta-this
@ -520,17 +523,17 @@
~
visible.a
==
=. ta-this
%+ ta-write (weld pax.a /[dat]/collections-config)
=. ta-this
%+ ta-write (weld pax.a /[dat]/collections-config)
[%collections-config !>(conf)]
:: restrict permissions on config file
=. ta-this
%^ ta-set-permissions (weld pax.a /[dat]/collections-config)
=. ta-this
%^ ta-set-permissions (weld pax.a /[dat]/collections-config)
[%white ((set whom:clay) [[& src.bol] ~ ~])] :: read
[%white ((set whom:clay) [[& src.bol] ~ ~])] :: write
:: open permissions on collection items
=. ta-this
%^ ta-set-permissions (weld pax.a /[dat])
=. ta-this
%^ ta-set-permissions (weld pax.a /[dat])
[%black ((set whom:clay) ~)] :: read
[%black ((set whom:clay) ~)] :: write
ta-this
@ -548,23 +551,23 @@
%- my
:~ [%name name.a]
[%comments ?:(comments.a ~..y ~..n)]
[%owner (scot %p src.bol)]
[%author (scot %p src.bol)]
[%host (scot %p our.bol)]
[%date-created (snag 0 (flop pax.a))]
[%last-modified dat]
[%type type.a]
==
=. ta-this
%+ ta-write (weld pax.a /udon)
=. ta-this
%+ ta-write (weld pax.a /udon)
[%udon !>((update-udon-front front content.a))]
:: restrict permissions on udon file
=. ta-this
%^ ta-set-permissions (weld pax.a /udon)
=. ta-this
%^ ta-set-permissions (weld pax.a /udon)
[%black ((set whom:clay) ~)] :: read
[%white ((set whom:clay) [[& src.bol] ~ ~])] :: write
:: open permissions on comments
=. ta-this
%^ ta-set-permissions pax.a
=. ta-this
%^ ta-set-permissions pax.a
[%black ((set whom:clay) ~)] :: read
[%black ((set whom:clay) ~)] :: write
ta-this
@ -576,18 +579,18 @@
=. content.a (crip (weld (trip content.a) "\0a"))
=/ front=(map knot cord)
%- my
:~ [%owner (scot %p src.bol)]
:~ [%author (scot %p src.bol)]
[%host (scot %p our.bol)]
[%date-created dat]
[%last-modified dat]
[%type %comments]
==
=. ta-this
%+ ta-write (weld pax.a /[dat]/udon)
=. ta-this
%+ ta-write (weld pax.a /[dat]/udon)
[%udon !>((update-udon-front front content.a))]
:: restrict permissions on udon file
=. ta-this
%^ ta-set-permissions (weld pax.a /[dat]/udon)
=. ta-this
%^ ta-set-permissions (weld pax.a /[dat]/udon)
[%black ((set whom:clay) ~)] :: read
[%white ((set whom:clay) [[& src.bol] ~ ~])] :: write
ta-this
@ -620,7 +623,7 @@
::
%collection
=. ta-this
%^ ta-hall-json parent-path 'new collection'
%^ ta-hall-json parent-path 'new collection'
(collection-notify pax meta.col.new)
::
=. ta-this (ta-hall-create-circle pax name.meta.col.new)
@ -643,18 +646,18 @@
::
%raw
=. ta-this
%^ ta-hall-json
parent-path
'new item'
%^ ta-hall-json
parent-path
'new item'
(item-notify pax raw.new now.bol byk.bol)
?: ?& (~(has by meta.raw.new) %comments)
=('.y' (~(got by meta.raw.new) %comments))
==
=/ owner=(unit @ta) (~(get by meta.raw.new) %owner)
=/ owner-p=@p
?~ owner our.bol
(fall (rush u.owner ;~(pfix sig fed:ag)) our.bol)
(ta-generate-comments pax owner-p)
=/ author=(unit @ta) (~(get by meta.raw.new) %author)
=/ author-p=@p
?~ author our.bol
(fall (rush u.author ;~(pfix sig fed:ag)) our.bol)
(ta-generate-comments pax author-p)
ta-this
::
==
@ -673,8 +676,8 @@
(ta-hall-lin parent 'error')
::
%collection
=. ta-this
%^ ta-hall-json parent 'deleted collection'
=. ta-this
%^ ta-hall-json parent 'deleted collection'
(collection-notify pax meta.col.old)
=. ta-this (ta-flush-permissions (weld pax /collections-config))
=/ items=(list [nom=@ta =item]) ~(tap by data.col.old)
@ -694,15 +697,15 @@
::
%raw
=. ta-this (ta-flush-permissions pax)
%^ ta-hall-json
parent
'deleted item'
%^ ta-hall-json
parent
'deleted item'
(item-notify pax raw.old now.bol byk.bol)
::
==
::
::
::
::
++ ta-update-item
:: always make sure removals happen first and insertions happen last
:: because removals flush permissions and insertions set them
@ -782,20 +785,20 @@
::
=? ta-this !=(data.old data.new)
=/ parent-path (scag (dec (lent pax)) pax)
%^ ta-hall-json
parent-path
'edited item'
%^ ta-hall-json
parent-path
'edited item'
(item-notify pax new now.bol byk.bol)
::
=? ta-this
?& =('.y' (fall (~(get by meta.new) %comments) '.n'))
=('.n' (fall (~(get by meta.old) %comments) '.n'))
==
=/ owner=(unit @ta) (~(get by meta.new) %owner)
=/ owner-p=@p
?~ owner our.bol
(fall (rush u.owner ;~(pfix sig fed:ag)) our.bol)
(ta-generate-comments pax owner-p)
=/ author=(unit @ta) (~(get by meta.new) %author)
=/ author-p=@p
?~ author our.bol
(fall (rush u.author ;~(pfix sig fed:ag)) our.bol)
(ta-generate-comments pax author-p)
::
=? ta-this
?& =('.n' (fall (~(get by meta.new) %comments) '.n'))
@ -872,7 +875,7 @@
::
++ ta-generate-comments
~/ %coll-ta-generate-comments
|= [pax=path owner=ship]
|= [pax=path author=ship]
^+ ta-this
=/ sup=path [%collections-config (flop pax)]
=/ bek byk.bol(r [%da now.bol])
@ -882,7 +885,7 @@
:* [bek sup]
'comments'
'comments'
owner
author
dat
dat
%comments
@ -961,7 +964,7 @@
(path-to-circle (scag (dec (lent pax)) pax) our.bol)
=/ acts=(list action:hall)
:~ [%source nom.parent & (sy `source:hall`[circ ~] ~)]
[%create nom.circ name %journal]
[%create nom.circ name %journal]
==
:: XX should we also source comment circles?
=? acts =(nom.parent %c)

View File

@ -9,7 +9,7 @@
++ grow
|%
++ mime
:- /text/x-collection-config
:- /text/x-collection-config
(as-octs:mimes:html (of-wain:format txt))
++ txt
^- wain
@ -18,7 +18,7 @@
(cat 3 'name: ' name.con)
(cat 3 'description: ' description.con)
::
(cat 3 'owner: ' (scot %p owner.con))
(cat 3 'author: ' (scot %p author.con))
::
(cat 3 'date-created: ' (scot %da date-created.con))
(cat 3 'last-modified: ' (scot %da last-modified.con))
@ -42,7 +42,7 @@
?> ?= $: full-path=@t
name=@t
desc=@t
owner=@t
author=@t
dc=@t
lm=@t
type=@t
@ -53,32 +53,32 @@
==
txs
::
:* %- need
%+ rash full-path.txs
;~ pfix (jest 'full-path: ')
:* %- need
%+ rash full-path.txs
;~ pfix (jest 'full-path: ')
%+ cook de-beam:format
;~(pfix fas (more fas urs:ab))
;~(pfix fas (more fas urs:ab))
==
::
(rash name.txs ;~(pfix (jest 'name: ') (cook crip (star next))))
::
(rash desc.txs ;~(pfix (jest 'description: ') (cook crip (star next))))
(rash name.txs ;~(pfix (jest 'name: ') (cook crip (star next))))
::
(rash owner.txs ;~(pfix (jest 'owner: ~') fed:ag))
(rash desc.txs ;~(pfix (jest 'description: ') (cook crip (star next))))
::
%+ rash dc.txs
;~ pfix
(jest 'date-created: ~')
(rash author.txs ;~(pfix (jest 'author: ~') fed:ag))
::
%+ rash dc.txs
;~ pfix
(jest 'date-created: ~')
(cook year when:so)
==
::
%+ rash lm.txs
;~ pfix
(jest 'last-modified: ~')
;~ pfix
(jest 'last-modified: ~')
(cook year when:so)
==
::
(rash type.txs ;~(pfix (jest 'type: ') (cook crip (star next))))
(rash type.txs ;~(pfix (jest 'type: ') (cook crip (star next))))
::
(rash com.txs ;~(pfix (jest 'comments: ') (fuss %y %n)))
::

View File

@ -113,7 +113,7 @@
=/ ht (hedtal:collections +.elm)
=/ title (fall (~(get by meta.raw) %name) -.s.bem.gas)
=/ date (fall (~(get by meta.raw) %date-created) 'missing date')
=/ owner (fall (~(get by meta.raw) %owner) 'anonymous')
=/ author (fall (~(get by meta.raw) %author) 'anonymous')
::
;div.mb-18.mt-4
;+ elm
@ -141,20 +141,20 @@
|= [nom=knot ite=item:collections]
^- manx
?> ?=(%raw -.ite)
=/ owner (fall (~(get by meta.raw.ite) %owner) 'anonymous')
=/ author (fall (~(get by meta.raw.ite) %author) 'anonymous')
=/ host (fall (~(get by meta.raw.ite) %host) 'anonymous')
=/ date (fall (~(get by meta.raw.ite) %date-created) 'missing date')
;li.mb-6
;div.flex.align-center
;div.mr-2
=urb-component "Sigil"
=urb-ship "{(trip owner)}"
=urb-ship "{(trip author)}"
=urb-size "18"
=urb-suffix "true";
;div
;a.vanilla.text-mono.text-small.text-700.mr-4
=href "/~~/{(trip host)}/==/web/landscape/profile"
; {(trip owner)}
; {(trip author)}
==
==
;div.text-host-breadcrumb
@ -210,7 +210,7 @@
;h2.mt-0.mb-0
;a(href lnk): {(trip name.meta.col)}
==
;div.who.text-mono.text-600: {<owner.meta.col>}
;div.who.text-mono.text-600: {<author.meta.col>}
;div.meta-cont
;div.com-count.ml-12
; {(trip (scot %ud ~(wyt by data.col)))} comments
@ -227,7 +227,7 @@
(scag 5 c.elm)
=/ title (fall (~(get by meta.raw) %name) nom)
=/ date (fall (~(get by meta.raw) %date-created) 'missing date')
=/ owner (fall (~(get by meta.raw) %owner) 'anonymous')
=/ author (fall (~(get by meta.raw) %author) 'anonymous')
=/ lnk=tape
"/~~/{(scow %p p.bem.gas)}/=={(spud (flop s.bem.gas))}/{(trip nom)}"
::
@ -238,7 +238,7 @@
;a(href lnk): {(trip title)}
;a(href lnk): *{hed.ht}
==
;div.who.text-mono.text-600: {(trip owner)}
;div.who.text-mono.text-600: {(trip author)}
;div.snippet
;* tal.ht
==
@ -262,7 +262,7 @@
;a(href lnk): {(trip title)}
;a(href lnk): *{hed.ht}
==
;div.text-mono.text-small.text-300.mt-1.mb-1: {<owner.meta.col>}
;div.text-mono.text-small.text-300.mt-1.mb-1: {<author.meta.col>}
;div
;div.icon-label.justify-start
;div(urb-component "IconComment");
@ -291,7 +291,7 @@
%collection
=* met meta.col.itm
:~ [%urb-name (trip name.met)]
[%urb-owner (scow %p owner.met)]
[%urb-author (scow %p author.met)]
[%urb-host (scow %p p.full-path.met)]
[%urb-date-created (scow %da date-created.met)]
[%urb-last-modified (scow %da last-modified.met)]
@ -301,7 +301,7 @@
%raw
=/ met ~(got by meta.raw.itm)
:~ [%urb-name (trip (met %name))]
[%urb-owner (trip (met %owner))]
[%urb-author (trip (met %author))]
[%urb-host (trip (met %host))]
[%urb-date-created (trip (met %date-created))]
[%urb-last-modified (trip (met %last-modified))]
@ -311,7 +311,7 @@
%both
=/ met ~(got by meta.raw.itm)
:~ [%urb-name (trip (met %name))]
[%urb-owner (trip (met %owner))]
[%urb-author (trip (met %author))]
[%urb-host (trip (met %host))]
[%urb-date-created (trip (met %date-created))]
[%urb-last-modified (trip (met %last-modified))]

File diff suppressed because one or more lines are too long

View File

@ -8,7 +8,7 @@
--
^- manx
;div
;input(type "hidden", name "urb-metadata", urb-structure-type "header-profile", urb-owner "{(scow %p p.bem.gas)}");
;input(type "hidden", name "urb-metadata", urb-structure-type "header-profile", urb-author "{(scow %p p.bem.gas)}");
;div.container
;div.row
;div.flex-col-2;

View File

@ -10,7 +10,7 @@
.^(@p %j /(scot %p p.bem.gas)/code/(scot r.bem.gas)/(scot %p p.bem.gas))
^- manx
;div
;input(type "hidden", name "urb-metadata", urb-structure-type "header-profile", urb-owner "{(scow %p p.bem.gas)}");
;input(type "hidden", name "urb-metadata", urb-structure-type "header-profile", urb-author "{(scow %p p.bem.gas)}");
;div.container(urb-devices "")
;div.row.mt-4
;div.flex-col-2;