mirror of
https://github.com/urbit/shrub.git
synced 2024-12-19 16:51:42 +03:00
Merge branch 'release/next-js' into tbcs/typescript-cleanup
This commit is contained in:
commit
05e3d4c75c
@ -70,10 +70,11 @@
|
|||||||
::
|
::
|
||||||
++ transform-proxy-update
|
++ transform-proxy-update
|
||||||
|= vas=vase
|
|= vas=vase
|
||||||
^- (unit vase)
|
^- (quip card (unit vase))
|
||||||
:: TODO: should check if user is allowed to %add, %remove, %edit
|
:: TODO: should check if user is allowed to %add, %remove, %edit
|
||||||
:: contact
|
:: contact
|
||||||
=/ =update:store !<(update:store vas)
|
=/ =update:store !<(update:store vas)
|
||||||
|
:- ~
|
||||||
?- -.update
|
?- -.update
|
||||||
%initial ~
|
%initial ~
|
||||||
%add `vas
|
%add `vas
|
||||||
|
@ -43,8 +43,8 @@
|
|||||||
::
|
::
|
||||||
++ transform-proxy-update
|
++ transform-proxy-update
|
||||||
|= vas=vase
|
|= vas=vase
|
||||||
^- (unit vase)
|
^- (quip card (unit vase))
|
||||||
`vas
|
``vas
|
||||||
::
|
::
|
||||||
++ resource-for-update
|
++ resource-for-update
|
||||||
|= =vase
|
|= =vase
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/- *group, metadata=metadata-store
|
/- *group, metadata=metadata-store
|
||||||
/+ store=graph-store, mdl=metadata, res=resource, graph, group, default-agent,
|
/+ store=graph-store, mdl=metadata, res=resource, graph, group, default-agent,
|
||||||
dbug, verb, push-hook
|
dbug, verb, push-hook, agentio
|
||||||
::
|
::
|
||||||
~% %graph-push-hook-top ..part ~
|
~% %graph-push-hook-top ..part ~
|
||||||
|%
|
|%
|
||||||
@ -25,6 +25,25 @@
|
|||||||
$% state-zero
|
$% state-zero
|
||||||
state-one
|
state-one
|
||||||
==
|
==
|
||||||
|
::
|
||||||
|
:: TODO: come back to this and potentially use send a %t
|
||||||
|
:: to be notified of validator changes
|
||||||
|
+$ cache
|
||||||
|
$: graph-to-mark=(map resource:res (unit mark))
|
||||||
|
perm-marks=(map [mark @tas] tube:clay)
|
||||||
|
transform-marks=(map mark tube:clay)
|
||||||
|
==
|
||||||
|
::
|
||||||
|
+$ inflated-state
|
||||||
|
$: state-one
|
||||||
|
cache
|
||||||
|
==
|
||||||
|
::
|
||||||
|
+$ cache-action
|
||||||
|
$% [%graph-to-mark (pair resource:res (unit mark))]
|
||||||
|
[%perm-marks (pair (pair mark @tas) tube:clay)]
|
||||||
|
[%transform-marks (pair mark tube:clay)]
|
||||||
|
==
|
||||||
--
|
--
|
||||||
::
|
::
|
||||||
%- agent:dbug
|
%- agent:dbug
|
||||||
@ -33,7 +52,8 @@
|
|||||||
%- (agent:push-hook config)
|
%- (agent:push-hook config)
|
||||||
^- agent
|
^- agent
|
||||||
=-
|
=-
|
||||||
=| state-one
|
~% %graph-push-hook-agent ..scry.hook-core ~
|
||||||
|
=| inflated-state
|
||||||
=* state -
|
=* state -
|
||||||
|_ =bowl:gall
|
|_ =bowl:gall
|
||||||
+* this .
|
+* this .
|
||||||
@ -41,10 +61,11 @@
|
|||||||
grp ~(. group bowl)
|
grp ~(. group bowl)
|
||||||
gra ~(. graph bowl)
|
gra ~(. graph bowl)
|
||||||
met ~(. mdl bowl)
|
met ~(. mdl bowl)
|
||||||
hc ~(. hook-core bowl)
|
hc ~(. hook-core bowl +.state)
|
||||||
|
io ~(. agentio bowl)
|
||||||
::
|
::
|
||||||
++ on-init on-init:def
|
++ on-init on-init:def
|
||||||
++ on-save !>(state)
|
++ on-save !>(-.state)
|
||||||
++ on-load
|
++ on-load
|
||||||
|= =vase
|
|= =vase
|
||||||
=+ !<(old=versioned-state vase)
|
=+ !<(old=versioned-state vase)
|
||||||
@ -53,9 +74,26 @@
|
|||||||
=? old ?=(%0 -.old)
|
=? old ?=(%0 -.old)
|
||||||
[%1 ~]
|
[%1 ~]
|
||||||
?> ?=(%1 -.old)
|
?> ?=(%1 -.old)
|
||||||
`this(state old)
|
`this(-.state old, +.state *cache)
|
||||||
|
::
|
||||||
|
++ on-poke
|
||||||
|
|= [=mark =vase]
|
||||||
|
^- (quip card _this)
|
||||||
|
?. =(mark %graph-cache-hook)
|
||||||
|
[~ this]
|
||||||
|
=/ a=cache-action !<(cache-action vase)
|
||||||
|
=* c +.state
|
||||||
|
=* graph-to-mark graph-to-mark.c
|
||||||
|
=* perm-marks perm-marks.c
|
||||||
|
=* transform-marks transform-marks.c
|
||||||
|
=. c
|
||||||
|
?- -.a
|
||||||
|
%graph-to-mark c(graph-to-mark (~(put by graph-to-mark) p.a q.a))
|
||||||
|
%perm-marks c(perm-marks (~(put by perm-marks) p.a q.a))
|
||||||
|
%transform-marks c(transform-marks (~(put by transform-marks) p.a q.a))
|
||||||
|
==
|
||||||
|
[~ this(+.state c)]
|
||||||
::
|
::
|
||||||
++ on-poke on-poke:def
|
|
||||||
++ on-agent on-agent:def
|
++ on-agent on-agent:def
|
||||||
++ on-watch on-watch:def
|
++ on-watch on-watch:def
|
||||||
++ on-leave on-leave:def
|
++ on-leave on-leave:def
|
||||||
@ -72,22 +110,39 @@
|
|||||||
::
|
::
|
||||||
++ on-fail on-fail:def
|
++ on-fail on-fail:def
|
||||||
++ transform-proxy-update
|
++ transform-proxy-update
|
||||||
|
~/ %transform-proxy-update
|
||||||
|= vas=vase
|
|= vas=vase
|
||||||
^- (unit vase)
|
^- (quip card (unit vase))
|
||||||
=/ =update:store !<(update:store vas)
|
=/ =update:store !<(update:store vas)
|
||||||
=* rid resource.q.update
|
=* rid resource.q.update
|
||||||
=. p.update now.bowl
|
=. p.update now.bowl
|
||||||
?- -.q.update
|
?- -.q.update
|
||||||
%add-nodes
|
%add-nodes
|
||||||
?. (is-allowed-add:hc rid nodes.q.update)
|
=| cards=(list card)
|
||||||
~
|
=^ allowed cards (is-allowed-add:hc rid nodes.q.update)
|
||||||
=/ mark (get-mark:gra rid)
|
?. allowed
|
||||||
?~ mark `vas
|
[cards ~]
|
||||||
|^
|
=/ mark-cached (~(has by graph-to-mark) rid)
|
||||||
|
=/ mark
|
||||||
|
?: mark-cached
|
||||||
|
(~(got by graph-to-mark) rid)
|
||||||
|
(get-mark:gra rid)
|
||||||
|
?~ mark
|
||||||
|
[cards `vas]
|
||||||
|
=< $
|
||||||
|
~% %transform-add-nodes ..transform-proxy-update ~
|
||||||
|
|%
|
||||||
|
++ $
|
||||||
|
^- (quip card (unit vase))
|
||||||
|
=/ transform-cached (~(has by transform-marks) u.mark)
|
||||||
|
=/ =tube:clay
|
||||||
|
?: transform-cached
|
||||||
|
(~(got by transform-marks) u.mark)
|
||||||
|
.^(tube:clay (scry:hc %cc %home /[u.mark]/transform-add-nodes))
|
||||||
=/ transform
|
=/ transform
|
||||||
!< $-([index:store post:store atom ?] [index:store post:store])
|
!< $-([index:store post:store atom ?] [index:store post:store])
|
||||||
%. !>(*indexed-post:store)
|
%. !>(*indexed-post:store)
|
||||||
.^(tube:clay (scry:hc %cc %home /[u.mark]/transform-add-nodes))
|
tube
|
||||||
=/ [* result=(list [index:store node:store])]
|
=/ [* result=(list [index:store node:store])]
|
||||||
%+ roll
|
%+ roll
|
||||||
(flatten-node-map ~(tap by nodes.q.update))
|
(flatten-node-map ~(tap by nodes.q.update))
|
||||||
@ -95,9 +150,24 @@
|
|||||||
=. nodes.q.update
|
=. nodes.q.update
|
||||||
%- ~(gas by *(map index:store node:store))
|
%- ~(gas by *(map index:store node:store))
|
||||||
result
|
result
|
||||||
[~ !>(update)]
|
:_ [~ !>(update)]
|
||||||
|
%+ weld cards
|
||||||
|
%- zing
|
||||||
|
:~ ?: mark-cached ~
|
||||||
|
:_ ~
|
||||||
|
%+ poke-self:pass:io %graph-cache-hook
|
||||||
|
!> ^- cache-action
|
||||||
|
[%graph-to-mark rid mark]
|
||||||
|
::
|
||||||
|
?: transform-cached ~
|
||||||
|
:_ ~
|
||||||
|
%+ poke-self:pass:io %graph-cache-hook
|
||||||
|
!> ^- cache-action
|
||||||
|
[%transform-marks u.mark tube]
|
||||||
|
==
|
||||||
::
|
::
|
||||||
++ flatten-node-map
|
++ flatten-node-map
|
||||||
|
~/ %flatten-node-map
|
||||||
|= lis=(list [index:store node:store])
|
|= lis=(list [index:store node:store])
|
||||||
^- (list [index:store node:store])
|
^- (list [index:store node:store])
|
||||||
|^
|
|^
|
||||||
@ -129,6 +199,7 @@
|
|||||||
--
|
--
|
||||||
::
|
::
|
||||||
++ transform-list
|
++ transform-list
|
||||||
|
~/ %transform-list
|
||||||
|= transform=$-([index:store post:store atom ?] [index:store post:store])
|
|= transform=$-([index:store post:store atom ?] [index:store post:store])
|
||||||
|= $: [=index:store =node:store]
|
|= $: [=index:store =node:store]
|
||||||
[indices=(set index:store) lis=(list [index:store node:store])]
|
[indices=(set index:store) lis=(list [index:store node:store])]
|
||||||
@ -151,27 +222,32 @@
|
|||||||
--
|
--
|
||||||
::
|
::
|
||||||
%remove-posts
|
%remove-posts
|
||||||
?. (is-allowed-remove:hc resource.q.update indices.q.update)
|
=| cards=(list card)
|
||||||
|
=^ allowed cards
|
||||||
|
(is-allowed-remove:hc rid indices.q.update)
|
||||||
|
:- cards
|
||||||
|
?. allowed
|
||||||
~
|
~
|
||||||
`vas
|
`vas
|
||||||
::
|
::
|
||||||
%add-graph ~
|
%add-graph [~ ~]
|
||||||
%remove-graph ~
|
%remove-graph [~ ~]
|
||||||
%add-signatures ~
|
%add-signatures [~ ~]
|
||||||
%remove-signatures ~
|
%remove-signatures [~ ~]
|
||||||
%archive-graph ~
|
%archive-graph [~ ~]
|
||||||
%unarchive-graph ~
|
%unarchive-graph [~ ~]
|
||||||
%add-tag ~
|
%add-tag [~ ~]
|
||||||
%remove-tag ~
|
%remove-tag [~ ~]
|
||||||
%keys ~
|
%keys [~ ~]
|
||||||
%tags ~
|
%tags [~ ~]
|
||||||
%tag-queries ~
|
%tag-queries [~ ~]
|
||||||
%run-updates ~
|
%run-updates [~ ~]
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ resource-for-update resource-for-update:gra
|
++ resource-for-update resource-for-update:gra
|
||||||
::
|
::
|
||||||
++ initial-watch
|
++ initial-watch
|
||||||
|
~/ %initial-watch
|
||||||
|= [=path =resource:res]
|
|= [=path =resource:res]
|
||||||
^- vase
|
^- vase
|
||||||
|^
|
|^
|
||||||
@ -211,11 +287,13 @@
|
|||||||
==
|
==
|
||||||
--
|
--
|
||||||
::
|
::
|
||||||
^| ^= hook-core
|
~% %graph-push-hook-helper ..card.hook-core ~
|
||||||
|_ =bowl:gall
|
^= hook-core
|
||||||
|
|_ [=bowl:gall =cache]
|
||||||
+* grp ~(. group bowl)
|
+* grp ~(. group bowl)
|
||||||
met ~(. mdl bowl)
|
met ~(. mdl bowl)
|
||||||
gra ~(. graph bowl)
|
gra ~(. graph bowl)
|
||||||
|
io ~(. agentio bowl)
|
||||||
::
|
::
|
||||||
++ scry
|
++ scry
|
||||||
|= [care=@t desk=@t =path]
|
|= [care=@t desk=@t =path]
|
||||||
@ -225,14 +303,38 @@
|
|||||||
::
|
::
|
||||||
++ perm-mark
|
++ perm-mark
|
||||||
|= [=resource:res perm=@t vip=vip-metadata:metadata =indexed-post:store]
|
|= [=resource:res perm=@t vip=vip-metadata:metadata =indexed-post:store]
|
||||||
^- permissions:store
|
^- [permissions:store (list card)]
|
||||||
|^
|
|^
|
||||||
=- (check vip)
|
=/ mark-cached (~(has by graph-to-mark.cache) resource)
|
||||||
!< check=$-(vip-metadata:metadata permissions:store)
|
=/ mark
|
||||||
%. !>(indexed-post)
|
?: mark-cached
|
||||||
=/ mark (get-mark:gra resource)
|
(~(got by graph-to-mark.cache) resource)
|
||||||
?~ mark |=(=vase !>([%no %no %no]))
|
(get-mark:gra resource)
|
||||||
|
?~ mark
|
||||||
|
[[%no %no %no] ~]
|
||||||
|
=/ key [u.mark (perm-mark-name perm)]
|
||||||
|
=/ perms-cached (~(has by perm-marks.cache) key)
|
||||||
|
=/ =tube:clay
|
||||||
|
?: perms-cached
|
||||||
|
(~(got by perm-marks.cache) key)
|
||||||
.^(tube:clay (scry %cc %home /[u.mark]/(perm-mark-name perm)))
|
.^(tube:clay (scry %cc %home /[u.mark]/(perm-mark-name perm)))
|
||||||
|
=/ check
|
||||||
|
!< $-(vip-metadata:metadata permissions:store)
|
||||||
|
(tube !>(indexed-post))
|
||||||
|
:- (check vip)
|
||||||
|
%- zing
|
||||||
|
:~ ?: mark-cached ~
|
||||||
|
:_ ~
|
||||||
|
%+ poke-self:pass:io %graph-cache-hook
|
||||||
|
!> ^- cache-action
|
||||||
|
[%graph-to-mark resource mark]
|
||||||
|
::
|
||||||
|
?: perms-cached ~
|
||||||
|
:_ ~
|
||||||
|
%+ poke-self:pass:io %graph-cache-hook
|
||||||
|
!> ^- cache-action
|
||||||
|
[%perm-marks [u.mark (perm-mark-name perm)] tube]
|
||||||
|
==
|
||||||
::
|
::
|
||||||
++ perm-mark-name
|
++ perm-mark-name
|
||||||
|= perm=@t
|
|= perm=@t
|
||||||
@ -252,15 +354,22 @@
|
|||||||
reader.permissions
|
reader.permissions
|
||||||
::
|
::
|
||||||
++ get-roles-writers-variation
|
++ get-roles-writers-variation
|
||||||
|
~/ %get-roles-writers-variation
|
||||||
|= =resource:res
|
|= =resource:res
|
||||||
^- (unit [is-admin=? writers=(set ship) vip=vip-metadata:metadata])
|
^- (unit [is-admin=? writers=(set ship) vip=vip-metadata:metadata])
|
||||||
=/ assoc=(unit association:metadata)
|
=/ assoc=(unit association:metadata)
|
||||||
(peek-association:met %graph resource)
|
(peek-association:met %graph resource)
|
||||||
?~ assoc ~
|
?~ assoc ~
|
||||||
|
=/ group=(unit group:grp)
|
||||||
|
(scry-group:grp group.u.assoc)
|
||||||
|
?~ group ~
|
||||||
=/ role=(unit (unit role-tag))
|
=/ role=(unit (unit role-tag))
|
||||||
(role-for-ship:grp group.u.assoc src.bowl)
|
(role-for-ship-with-group:grp u.group group.u.assoc src.bowl)
|
||||||
=/ writers=(set ship)
|
=/ writers=(set ship)
|
||||||
(get-tagged-ships:grp group.u.assoc [%graph resource %writers])
|
%^ get-tagged-ships-with-group:grp
|
||||||
|
u.group
|
||||||
|
group.u.assoc
|
||||||
|
[%graph resource %writers]
|
||||||
?~ role ~
|
?~ role ~
|
||||||
=/ is-admin=?
|
=/ is-admin=?
|
||||||
?=(?([~ %admin] [~ %moderator]) u.role)
|
?=(?([~ %admin] [~ %moderator]) u.role)
|
||||||
@ -274,28 +383,47 @@
|
|||||||
[(snag (dec (lent index)) index) p.post.node]
|
[(snag (dec (lent index)) index) p.post.node]
|
||||||
::
|
::
|
||||||
++ is-allowed-add
|
++ is-allowed-add
|
||||||
|
~/ %is-allowed-add
|
||||||
|= [=resource:res nodes=(map index:store node:store)]
|
|= [=resource:res nodes=(map index:store node:store)]
|
||||||
^- ?
|
^- [? (list card)]
|
||||||
|^
|
|^
|
||||||
%- (bond |.(%.n))
|
%- (bond |.([%.n ~]))
|
||||||
%+ biff (get-roles-writers-variation resource)
|
%+ biff (get-roles-writers-variation resource)
|
||||||
|= [is-admin=? writers=(set ship) vip=vip-metadata:metadata]
|
|= [is-admin=? writers=(set ship) vip=vip-metadata:metadata]
|
||||||
^- (unit ?)
|
^- (unit [? (list card)])
|
||||||
%- some
|
%- some
|
||||||
%+ levy ~(tap by nodes)
|
=/ a ~(tap by nodes)
|
||||||
|= [=index:store =node:store]
|
=| cards=(list card)
|
||||||
|
|- ^- [? (list card)]
|
||||||
|
?~ a [& cards]
|
||||||
|
=/ c (check i.a is-admin writers vip)
|
||||||
|
?. -.c
|
||||||
|
[| (weld cards +.c)]
|
||||||
|
$(a t.a, cards (weld cards +.c))
|
||||||
|
::
|
||||||
|
++ check
|
||||||
|
|= $: [=index:store =node:store]
|
||||||
|
is-admin=?
|
||||||
|
writers=(set ship)
|
||||||
|
vip=vip-metadata:metadata
|
||||||
|
==
|
||||||
|
^- [? (list card)]
|
||||||
=/ parent-index=index:store
|
=/ parent-index=index:store
|
||||||
(scag (dec (lent index)) index)
|
(scag (dec (lent index)) index)
|
||||||
?: (~(has by nodes) parent-index) %.y
|
?: (~(has by nodes) parent-index)
|
||||||
|
[%.y ~]
|
||||||
?: ?=(%| -.post.node)
|
?: ?=(%| -.post.node)
|
||||||
%.n
|
[%.n ~]
|
||||||
?. =(author.p.post.node src.bowl)
|
?. =(author.p.post.node src.bowl)
|
||||||
%.n
|
[%.n ~]
|
||||||
=/ =permissions:store
|
=/ added
|
||||||
%^ add-mark resource vip
|
%^ add-mark resource vip
|
||||||
(node-to-indexed-post node)
|
(node-to-indexed-post node)
|
||||||
|
=* permissions -.added
|
||||||
|
=* cards +.added
|
||||||
=/ =permission-level:store
|
=/ =permission-level:store
|
||||||
(get-permission permissions is-admin writers)
|
(get-permission permissions is-admin writers)
|
||||||
|
:_ cards
|
||||||
?- permission-level
|
?- permission-level
|
||||||
%yes %.y
|
%yes %.y
|
||||||
%no %.n
|
%no %.n
|
||||||
@ -314,24 +442,38 @@
|
|||||||
--
|
--
|
||||||
::
|
::
|
||||||
++ is-allowed-remove
|
++ is-allowed-remove
|
||||||
|
~/ %is-allowed-remove
|
||||||
|= [=resource:res indices=(set index:store)]
|
|= [=resource:res indices=(set index:store)]
|
||||||
^- ?
|
^- [? (list card)]
|
||||||
|^
|
|^
|
||||||
%- (bond |.(%.n))
|
%- (bond |.([%.n ~]))
|
||||||
%+ biff (get-roles-writers-variation resource)
|
%+ biff (get-roles-writers-variation resource)
|
||||||
|= [is-admin=? writers=(set ship) vip=vip-metadata:metadata]
|
|= [is-admin=? writers=(set ship) vip=vip-metadata:metadata]
|
||||||
%- some
|
%- some
|
||||||
%+ levy ~(tap by indices)
|
=/ a ~(tap by indices)
|
||||||
|= =index:store
|
=| cards=(list card)
|
||||||
^- ?
|
|- ^- [? (list card)]
|
||||||
|
?~ a [& cards]
|
||||||
|
=/ c (check i.a is-admin writers vip)
|
||||||
|
?. -.c
|
||||||
|
[| (weld cards +.c)]
|
||||||
|
$(a t.a, cards (weld cards +.c))
|
||||||
|
::
|
||||||
|
++ check
|
||||||
|
|= [=index:store is-admin=? writers=(set ship) vip=vip-metadata:metadata]
|
||||||
|
^- [? (list card)]
|
||||||
=/ =node:store
|
=/ =node:store
|
||||||
(got-node:gra resource index)
|
(got-node:gra resource index)
|
||||||
?: ?=(%| -.post.node) %.n
|
?: ?=(%| -.post.node)
|
||||||
=/ =permissions:store
|
[%.n ~]
|
||||||
|
=/ removed
|
||||||
%^ remove-mark resource vip
|
%^ remove-mark resource vip
|
||||||
(node-to-indexed-post node)
|
(node-to-indexed-post node)
|
||||||
|
=* permissions -.removed
|
||||||
|
=* cards +.removed
|
||||||
=/ =permission-level:store
|
=/ =permission-level:store
|
||||||
(get-permission permissions is-admin writers)
|
(get-permission permissions is-admin writers)
|
||||||
|
:_ cards
|
||||||
?- permission-level
|
?- permission-level
|
||||||
%yes %.y
|
%yes %.y
|
||||||
%no %.n
|
%no %.n
|
||||||
|
@ -18,9 +18,20 @@
|
|||||||
++ orm orm:store
|
++ orm orm:store
|
||||||
++ orm-log orm-log:store
|
++ orm-log orm-log:store
|
||||||
+$ debug-input [%validate-graph =resource:store]
|
+$ debug-input [%validate-graph =resource:store]
|
||||||
|
::
|
||||||
|
+$ cache
|
||||||
|
$: validators=(map mark dais:clay)
|
||||||
|
==
|
||||||
|
::
|
||||||
|
:: TODO: come back to this and potentially use ford runes or otherwise
|
||||||
|
:: send a %t to be notified of validator changes
|
||||||
|
+$ inflated-state
|
||||||
|
$: state-5
|
||||||
|
cache
|
||||||
|
==
|
||||||
--
|
--
|
||||||
::
|
::
|
||||||
=| state-5
|
=| inflated-state
|
||||||
=* state -
|
=* state -
|
||||||
::
|
::
|
||||||
%- agent:dbug
|
%- agent:dbug
|
||||||
@ -32,7 +43,7 @@
|
|||||||
def ~(. (default-agent this %|) bowl)
|
def ~(. (default-agent this %|) bowl)
|
||||||
::
|
::
|
||||||
++ on-init [~ this]
|
++ on-init [~ this]
|
||||||
++ on-save !>(state)
|
++ on-save !>(-.state)
|
||||||
++ on-load
|
++ on-load
|
||||||
|= =old=vase
|
|= =old=vase
|
||||||
^- (quip card _this)
|
^- (quip card _this)
|
||||||
@ -108,7 +119,7 @@
|
|||||||
(gas:orm-log ~ [now.bowl logged-update] ~)
|
(gas:orm-log ~ [now.bowl logged-update] ~)
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
%5 [cards this(state old)]
|
%5 [cards this(-.state old, +.state *cache)]
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ on-watch
|
++ on-watch
|
||||||
@ -180,7 +191,9 @@
|
|||||||
!(~(has by graphs) resource)
|
!(~(has by graphs) resource)
|
||||||
== ==
|
== ==
|
||||||
~| "validation of graph {<resource>} failed using mark {<mark>}"
|
~| "validation of graph {<resource>} failed using mark {<mark>}"
|
||||||
?> (validate-graph graph mark)
|
=^ is-valid state
|
||||||
|
(validate-graph graph mark)
|
||||||
|
?> is-valid
|
||||||
=/ =logged-update:store
|
=/ =logged-update:store
|
||||||
[time %add-graph resource graph mark overwrite]
|
[time %add-graph resource graph mark overwrite]
|
||||||
=/ =update-log:store
|
=/ =update-log:store
|
||||||
@ -217,6 +230,10 @@
|
|||||||
(~(got by graphs) resource)
|
(~(got by graphs) resource)
|
||||||
~| "cannot add duplicate nodes to {<resource>}"
|
~| "cannot add duplicate nodes to {<resource>}"
|
||||||
?< (check-for-duplicates graph ~(key by nodes))
|
?< (check-for-duplicates graph ~(key by nodes))
|
||||||
|
~| "validation of nodes failed using mark {<mark>}"
|
||||||
|
=^ is-valid state
|
||||||
|
(check-validity ~(tap by nodes) mark)
|
||||||
|
?> is-valid
|
||||||
=/ =update-log:store (~(got by update-logs) resource)
|
=/ =update-log:store (~(got by update-logs) resource)
|
||||||
=. update-log
|
=. update-log
|
||||||
(put:orm-log update-log time [time [%add-nodes resource nodes]])
|
(put:orm-log update-log time [time [%add-nodes resource nodes]])
|
||||||
@ -231,6 +248,17 @@
|
|||||||
(add-node-list resource graph mark (sort-nodes nodes))
|
(add-node-list resource graph mark (sort-nodes nodes))
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
|
++ check-validity
|
||||||
|
|= [lis=(list (pair index:store node:store)) mark=(unit ^mark)]
|
||||||
|
^- [? _state]
|
||||||
|
|-
|
||||||
|
?~ lis [& state]
|
||||||
|
=^ is-valid state
|
||||||
|
(validate-graph (gas:orm ~ [(rear p.i.lis) q.i.lis]~) mark)
|
||||||
|
?. is-valid
|
||||||
|
[| state]
|
||||||
|
$(lis t.lis)
|
||||||
|
::
|
||||||
++ check-for-duplicates
|
++ check-for-duplicates
|
||||||
|= [=graph:store nodes=(set index:store)]
|
|= [=graph:store nodes=(set index:store)]
|
||||||
^- ?
|
^- ?
|
||||||
@ -288,8 +316,6 @@
|
|||||||
==
|
==
|
||||||
^- graph:store
|
^- graph:store
|
||||||
?< ?=(~ index)
|
?< ?=(~ index)
|
||||||
~| "validation of node failed using mark {<mark>}"
|
|
||||||
?> (validate-graph (gas:orm ~ [i.index node]~) mark)
|
|
||||||
=* atom i.index
|
=* atom i.index
|
||||||
%^ put:orm
|
%^ put:orm
|
||||||
graph
|
graph
|
||||||
@ -588,18 +614,24 @@
|
|||||||
^- (quip card _state)
|
^- (quip card _state)
|
||||||
=/ [=graph:store mark=(unit mark:store)]
|
=/ [=graph:store mark=(unit mark:store)]
|
||||||
(~(got by graphs) resource.debug-input)
|
(~(got by graphs) resource.debug-input)
|
||||||
?> (validate-graph graph mark)
|
=^ is-valid state
|
||||||
|
(validate-graph graph mark)
|
||||||
|
?> is-valid
|
||||||
[~ state]
|
[~ state]
|
||||||
::
|
::
|
||||||
++ validate-graph
|
++ validate-graph
|
||||||
|= [=graph:store mark=(unit mark:store)]
|
|= [=graph:store mark=(unit mark:store)]
|
||||||
^- ?
|
^- [? _state]
|
||||||
?~ mark %.y
|
?~ mark [%.y state]
|
||||||
|
=/ has-dais (~(has by validators) u.mark)
|
||||||
=/ =dais:clay
|
=/ =dais:clay
|
||||||
|
?: has-dais
|
||||||
|
(~(got by validators) u.mark)
|
||||||
.^ =dais:clay
|
.^ =dais:clay
|
||||||
%cb
|
%cb
|
||||||
/(scot %p our.bowl)/[q.byk.bowl]/(scot %da now.bowl)/[u.mark]
|
/(scot %p our.bowl)/[q.byk.bowl]/(scot %da now.bowl)/[u.mark]
|
||||||
==
|
==
|
||||||
|
:_ state(validators (~(put by validators) u.mark dais))
|
||||||
|- ^- ?
|
|- ^- ?
|
||||||
?~ graph %.y
|
?~ graph %.y
|
||||||
%+ roll (tap:orm graph)
|
%+ roll (tap:orm graph)
|
||||||
@ -617,7 +649,9 @@
|
|||||||
++ poke-import
|
++ poke-import
|
||||||
|= arc=*
|
|= arc=*
|
||||||
^- (quip card _state)
|
^- (quip card _state)
|
||||||
|
=^ cards -.state
|
||||||
(import:store arc our.bowl)
|
(import:store arc our.bowl)
|
||||||
|
[cards state]
|
||||||
--
|
--
|
||||||
::
|
::
|
||||||
++ on-peek
|
++ on-peek
|
||||||
|
@ -47,8 +47,9 @@
|
|||||||
::
|
::
|
||||||
++ transform-proxy-update
|
++ transform-proxy-update
|
||||||
|= vas=vase
|
|= vas=vase
|
||||||
^- (unit vase)
|
^- (quip card (unit vase))
|
||||||
=/ =update:store !<(update:store vas)
|
=/ =update:store !<(update:store vas)
|
||||||
|
:- ~
|
||||||
?: ?=(%initial -.update)
|
?: ?=(%initial -.update)
|
||||||
~
|
~
|
||||||
|^
|
|^
|
||||||
|
@ -59,8 +59,9 @@
|
|||||||
::
|
::
|
||||||
++ transform-proxy-update
|
++ transform-proxy-update
|
||||||
|= vas=vase
|
|= vas=vase
|
||||||
^- (unit vase)
|
^- (quip card (unit vase))
|
||||||
=/ =update:store !<(update:store vas)
|
=/ =update:store !<(update:store vas)
|
||||||
|
:- ~
|
||||||
?. ?=(?(%add %remove) -.update)
|
?. ?=(?(%add %remove) -.update)
|
||||||
~
|
~
|
||||||
=/ role=(unit (unit role-tag))
|
=/ role=(unit (unit role-tag))
|
||||||
|
@ -75,7 +75,12 @@
|
|||||||
=/ grp=(unit group)
|
=/ grp=(unit group)
|
||||||
(scry-group rid)
|
(scry-group rid)
|
||||||
?~ grp ~
|
?~ grp ~
|
||||||
=* group u.grp
|
(role-for-ship-with-group u.grp rid ship)
|
||||||
|
::
|
||||||
|
++ role-for-ship-with-group
|
||||||
|
|= [grp=group rid=resource =ship]
|
||||||
|
^- (unit (unit role-tag))
|
||||||
|
=* group grp
|
||||||
=* policy policy.group
|
=* policy policy.group
|
||||||
=* tags tags.group
|
=* tags tags.group
|
||||||
=/ admins=(set ^ship)
|
=/ admins=(set ^ship)
|
||||||
@ -107,7 +112,12 @@
|
|||||||
=/ grp=(unit group)
|
=/ grp=(unit group)
|
||||||
(scry-group rid)
|
(scry-group rid)
|
||||||
?~ grp ~
|
?~ grp ~
|
||||||
(~(get ju tags.u.grp) tag)
|
(get-tagged-ships-with-group u.grp rid tag)
|
||||||
|
::
|
||||||
|
++ get-tagged-ships-with-group
|
||||||
|
|= [grp=group rid=resource =tag]
|
||||||
|
^- (set ship)
|
||||||
|
(~(get ju tags.grp) tag)
|
||||||
::
|
::
|
||||||
++ is-managed
|
++ is-managed
|
||||||
|= rid=resource
|
|= rid=resource
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
::
|
::
|
||||||
/- *push-hook
|
/- *push-hook
|
||||||
/+ default-agent, resource, verb, versioning, agentio
|
/+ default-agent, resource, verb, versioning, agentio
|
||||||
|
~% %push-hook-top ..part ~
|
||||||
|%
|
|%
|
||||||
+$ card card:agent:gall
|
+$ card card:agent:gall
|
||||||
::
|
::
|
||||||
@ -84,6 +85,7 @@
|
|||||||
%.n
|
%.n
|
||||||
::
|
::
|
||||||
++ push-hook
|
++ push-hook
|
||||||
|
~/ %push-hook
|
||||||
|* =config
|
|* =config
|
||||||
$_ ^|
|
$_ ^|
|
||||||
|_ bowl:gall
|
|_ bowl:gall
|
||||||
@ -113,7 +115,7 @@
|
|||||||
::
|
::
|
||||||
++ transform-proxy-update
|
++ transform-proxy-update
|
||||||
|~ vase
|
|~ vase
|
||||||
*(unit vase)
|
*[(list card) (unit vase)]
|
||||||
:: +initial-watch: produce initial state for a subscription
|
:: +initial-watch: produce initial state for a subscription
|
||||||
::
|
::
|
||||||
:: .resource is the resource being subscribed to.
|
:: .resource is the resource being subscribed to.
|
||||||
@ -175,6 +177,7 @@
|
|||||||
=* state -
|
=* state -
|
||||||
^- agent:gall
|
^- agent:gall
|
||||||
=<
|
=<
|
||||||
|
~% %push-agent-lib ..poke-hook-action ~
|
||||||
|_ =bowl:gall
|
|_ =bowl:gall
|
||||||
+* this .
|
+* this .
|
||||||
og ~(. push-hook bowl)
|
og ~(. push-hook bowl)
|
||||||
@ -267,6 +270,7 @@
|
|||||||
!>(state)
|
!>(state)
|
||||||
::
|
::
|
||||||
++ on-poke
|
++ on-poke
|
||||||
|
~/ %on-poke
|
||||||
|= [=mark =vase]
|
|= [=mark =vase]
|
||||||
^- (quip card:agent:gall agent:gall)
|
^- (quip card:agent:gall agent:gall)
|
||||||
?: =(mark %push-hook-action)
|
?: =(mark %push-hook-action)
|
||||||
@ -283,6 +287,7 @@
|
|||||||
[cards this]
|
[cards this]
|
||||||
::
|
::
|
||||||
++ on-watch
|
++ on-watch
|
||||||
|
~/ %on-watch
|
||||||
|= =path
|
|= =path
|
||||||
^- (quip card:agent:gall agent:gall)
|
^- (quip card:agent:gall agent:gall)
|
||||||
?: ?=([%version ~] path)
|
?: ?=([%version ~] path)
|
||||||
@ -320,6 +325,7 @@
|
|||||||
--
|
--
|
||||||
::
|
::
|
||||||
++ on-agent
|
++ on-agent
|
||||||
|
~/ %on-agent
|
||||||
|= [=wire =sign:agent:gall]
|
|= [=wire =sign:agent:gall]
|
||||||
^- (quip card:agent:gall agent:gall)
|
^- (quip card:agent:gall agent:gall)
|
||||||
?. ?=([%helper %push-hook @ *] wire)
|
?. ?=([%helper %push-hook @ *] wire)
|
||||||
@ -373,6 +379,7 @@
|
|||||||
[%x %min-version ~] ``version+!>(version.config)
|
[%x %min-version ~] ``version+!>(version.config)
|
||||||
==
|
==
|
||||||
--
|
--
|
||||||
|
~% %push-helper-lib ..card ~
|
||||||
|_ =bowl:gall
|
|_ =bowl:gall
|
||||||
+* og ~(. push-hook bowl)
|
+* og ~(. push-hook bowl)
|
||||||
ver ~(. versioning [bowl [update-mark version min-version]:config])
|
ver ~(. versioning [bowl [update-mark version min-version]:config])
|
||||||
@ -380,6 +387,7 @@
|
|||||||
pass pass:io
|
pass pass:io
|
||||||
::
|
::
|
||||||
++ poke-hook-action
|
++ poke-hook-action
|
||||||
|
~/ %poke-hook-action
|
||||||
|= =action
|
|= =action
|
||||||
^- (quip card:agent:gall _state)
|
^- (quip card:agent:gall _state)
|
||||||
|^
|
|^
|
||||||
@ -448,6 +456,7 @@
|
|||||||
[%pass wire %agent [our.bowl store-name.config] %watch store-path.config]
|
[%pass wire %agent [our.bowl store-name.config] %watch store-path.config]
|
||||||
::
|
::
|
||||||
++ push-updates
|
++ push-updates
|
||||||
|
~/ %push-updates
|
||||||
|= =cage
|
|= =cage
|
||||||
^- (list card:agent:gall)
|
^- (list card:agent:gall)
|
||||||
%+ roll (resource-for-update q.cage)
|
%+ roll (resource-for-update q.cage)
|
||||||
@ -484,6 +493,7 @@
|
|||||||
--
|
--
|
||||||
::
|
::
|
||||||
++ forward-update
|
++ forward-update
|
||||||
|
~/ %forward-update
|
||||||
|= =cage
|
|= =cage
|
||||||
^- (list card:agent:gall)
|
^- (list card:agent:gall)
|
||||||
=- lis
|
=- lis
|
||||||
@ -494,22 +504,24 @@
|
|||||||
^- [(list card:agent:gall) (unit vase)]
|
^- [(list card:agent:gall) (unit vase)]
|
||||||
=/ =path
|
=/ =path
|
||||||
resource+(en-path:resource rid)
|
resource+(en-path:resource rid)
|
||||||
=/ =wire (make-wire path)
|
|
||||||
=* ship entity.rid
|
=* ship entity.rid
|
||||||
=. tf-vas
|
=/ out=(pair (list card:agent:gall) (unit vase))
|
||||||
?. =(our.bowl ship)
|
?. =(our.bowl ship)
|
||||||
:: do not transform before forwarding
|
:: do not transform before forwarding
|
||||||
::
|
::
|
||||||
`vas
|
``vas
|
||||||
:: use cached transform
|
:: use cached transform
|
||||||
::
|
::
|
||||||
?^ tf-vas tf-vas
|
?^ tf-vas `tf-vas
|
||||||
:: transform before poking store
|
:: transform before poking store
|
||||||
::
|
::
|
||||||
(transform-proxy-update:og vas)
|
(transform-proxy-update:og vas)
|
||||||
~| "forwarding failed during transform. mark: {<p.cage>} resource: {<rid>}"
|
~| "forwarding failed during transform. mark: {<p.cage>} rid: {<rid>}"
|
||||||
?> ?=(^ tf-vas)
|
?> ?=(^ q.out)
|
||||||
=/ =dock
|
:_ q.out
|
||||||
|
:_ (weld lis p.out)
|
||||||
|
=/ =wire (make-wire path)
|
||||||
|
=- [%pass wire %agent - %poke [current-version:ver u.q.out]]
|
||||||
:- ship
|
:- ship
|
||||||
?. =(our.bowl ship)
|
?. =(our.bowl ship)
|
||||||
:: forward to host
|
:: forward to host
|
||||||
@ -518,11 +530,6 @@
|
|||||||
:: poke our store
|
:: poke our store
|
||||||
::
|
::
|
||||||
store-name.config
|
store-name.config
|
||||||
=/ cag=^cage
|
|
||||||
:- current-version:ver
|
|
||||||
u.tf-vas
|
|
||||||
:_ tf-vas
|
|
||||||
[[%pass wire %agent dock %poke cag] lis]
|
|
||||||
::
|
::
|
||||||
++ ver-from-path
|
++ ver-from-path
|
||||||
|= =path
|
|= =path
|
||||||
@ -532,6 +539,7 @@
|
|||||||
(slav %ud i.extra)
|
(slav %ud i.extra)
|
||||||
::
|
::
|
||||||
++ resource-for-update
|
++ resource-for-update
|
||||||
|
~/ %resource-for-update
|
||||||
|= =vase
|
|= =vase
|
||||||
^- (list resource)
|
^- (list resource)
|
||||||
%~ tap in
|
%~ tap in
|
||||||
|
20
pkg/arvo/mar/graph/cache/hook.hoon
vendored
Normal file
20
pkg/arvo/mar/graph/cache/hook.hoon
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/- metadata=metadata-store, res=resource
|
||||||
|
|%
|
||||||
|
+$ cache-action
|
||||||
|
$% [%graph-to-mark (pair resource:res (unit mark))]
|
||||||
|
[%perm-marks (pair (pair mark @tas) tube:clay)]
|
||||||
|
[%transform-marks (pair mark tube:clay)]
|
||||||
|
==
|
||||||
|
--
|
||||||
|
::
|
||||||
|
|_ act=cache-action
|
||||||
|
++ grad %noun
|
||||||
|
++ grow
|
||||||
|
|%
|
||||||
|
++ noun act
|
||||||
|
--
|
||||||
|
++ grab
|
||||||
|
|%
|
||||||
|
++ noun cache-action
|
||||||
|
--
|
||||||
|
--
|
35
pkg/interface/package-lock.json
generated
35
pkg/interface/package-lock.json
generated
@ -9133,9 +9133,38 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"remark-breaks": {
|
"remark-breaks": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/remark-breaks/-/remark-breaks-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/remark-breaks/-/remark-breaks-2.0.2.tgz",
|
||||||
"integrity": "sha512-CZKI8xdPUnvMqPxYEIBBUg8C0B0kyn14lkW0abzhfh/P71YRIxCC3wvBh6AejQL602OxF6kNRl1x4HAZA07JyQ=="
|
"integrity": "sha512-LsQnPPQ7Fzp9RTjj4IwdEmjPOr9bxe9zYKWhs9ZQOg9hMg8rOfeeqQ410cvVdIK87Famqza1CKRxNkepp2EvUA==",
|
||||||
|
"requires": {
|
||||||
|
"unist-util-visit": "^2.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"unist-util-is": {
|
||||||
|
"version": "4.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-4.1.0.tgz",
|
||||||
|
"integrity": "sha512-ZOQSsnce92GrxSqlnEEseX0gi7GH9zTJZ0p9dtu87WRb/37mMPO2Ilx1s/t9vBHrFhbgweUwb+t7cIn5dxPhZg=="
|
||||||
|
},
|
||||||
|
"unist-util-visit": {
|
||||||
|
"version": "2.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-2.0.3.tgz",
|
||||||
|
"integrity": "sha512-iJ4/RczbJMkD0712mGktuGpm/U4By4FfDonL7N/9tATGIF4imikjOuagyMY53tnZq3NP6BcmlrHhEKAfGWjh7Q==",
|
||||||
|
"requires": {
|
||||||
|
"@types/unist": "^2.0.0",
|
||||||
|
"unist-util-is": "^4.0.0",
|
||||||
|
"unist-util-visit-parents": "^3.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"unist-util-visit-parents": {
|
||||||
|
"version": "3.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-3.1.1.tgz",
|
||||||
|
"integrity": "sha512-1KROIZWo6bcMrZEwiH2UrXDyalAa0uqzWCxCJj6lPOvTve2WkfgCytoDTPaMnodXh1WrXOq0haVYHj99ynJlsg==",
|
||||||
|
"requires": {
|
||||||
|
"@types/unist": "^2.0.0",
|
||||||
|
"unist-util-is": "^4.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"remark-disable-tokenizers": {
|
"remark-disable-tokenizers": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
"react-virtuoso": "^0.20.3",
|
"react-virtuoso": "^0.20.3",
|
||||||
"react-visibility-sensor": "^5.1.1",
|
"react-visibility-sensor": "^5.1.1",
|
||||||
"remark": "^12.0.0",
|
"remark": "^12.0.0",
|
||||||
"remark-breaks": "^2.0.1",
|
"remark-breaks": "^2.0.2",
|
||||||
"remark-disable-tokenizers": "1.1.0",
|
"remark-disable-tokenizers": "1.1.0",
|
||||||
"stacktrace-js": "^2.0.2",
|
"stacktrace-js": "^2.0.2",
|
||||||
"style-loader": "^1.3.0",
|
"style-loader": "^1.3.0",
|
||||||
|
@ -58,13 +58,7 @@ const tokenizeMessage = (text) => {
|
|||||||
|| (str === '`' && !isInCodeBlock)
|
|| (str === '`' && !isInCodeBlock)
|
||||||
) {
|
) {
|
||||||
isInCodeBlock = true;
|
isInCodeBlock = true;
|
||||||
} else if (
|
|
||||||
(str.endsWith('`') && str !== '`')
|
|
||||||
|| (str === '`' && isInCodeBlock)
|
|
||||||
) {
|
|
||||||
isInCodeBlock = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isRef(str) && !isInCodeBlock) {
|
if(isRef(str) && !isInCodeBlock) {
|
||||||
if (currTextLine.length > 0 || currTextBlock.length > 0) {
|
if (currTextLine.length > 0 || currTextBlock.length > 0) {
|
||||||
// If we're in the middle of a message, add it to the stack and reset
|
// If we're in the middle of a message, add it to the stack and reset
|
||||||
@ -105,6 +99,13 @@ const tokenizeMessage = (text) => {
|
|||||||
} else {
|
} else {
|
||||||
currTextLine.push(str);
|
currTextLine.push(str);
|
||||||
}
|
}
|
||||||
|
if (
|
||||||
|
(str.endsWith('`') && str !== '`')
|
||||||
|
|| (str === '`' && isInCodeBlock)
|
||||||
|
) {
|
||||||
|
isInCodeBlock = false;
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
currTextBlock.push(currTextLine.join(' '))
|
currTextBlock.push(currTextLine.join(' '))
|
||||||
|
@ -491,7 +491,8 @@ export const Message = React.memo(({
|
|||||||
width='36px'
|
width='36px'
|
||||||
textAlign='right'
|
textAlign='right'
|
||||||
left={0}
|
left={0}
|
||||||
top='3px'
|
top='2px'
|
||||||
|
lineHeight="tall"
|
||||||
fontSize={0}
|
fontSize={0}
|
||||||
gray
|
gray
|
||||||
>
|
>
|
||||||
|
@ -87,7 +87,7 @@ class LinkWindow extends Component<LinkWindowProps, {}> {
|
|||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<Box ref={ref}>
|
<Box ref={ref}>
|
||||||
<LinkItem key={index.toString()} {...linkProps} />;
|
<LinkItem key={index.toString()} {...linkProps} />
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -172,7 +172,7 @@ function DaySection({
|
|||||||
{_.map(timeboxes.sort(sortTimeboxes), ([date, nots], i: number) =>
|
{_.map(timeboxes.sort(sortTimeboxes), ([date, nots], i: number) =>
|
||||||
_.map(nots.sort(sortIndexedNotification), (not, j: number) => (
|
_.map(nots.sort(sortIndexedNotification), (not, j: number) => (
|
||||||
<Notification
|
<Notification
|
||||||
key={getNotificationKey(time, not)}
|
key={getNotificationKey(date, not)}
|
||||||
api={api}
|
api={api}
|
||||||
notification={not}
|
notification={not}
|
||||||
archived={archive}
|
archived={archive}
|
||||||
|
@ -91,6 +91,7 @@ export function GroupLink(
|
|||||||
<Icon icon='Users' color='gray' mr='1' />
|
<Icon icon='Users' color='gray' mr='1' />
|
||||||
<Text fontSize='0'color='gray' >
|
<Text fontSize='0'color='gray' >
|
||||||
{preview.members}
|
{preview.members}
|
||||||
|
{' '}
|
||||||
{preview.members > 1 ? 'peers' : 'peer'}
|
{preview.members > 1 ? 'peers' : 'peer'}
|
||||||
</Text>
|
</Text>
|
||||||
</Box>
|
</Box>
|
||||||
|
@ -203,8 +203,9 @@ function InviteActions(props: {
|
|||||||
app?: string;
|
app?: string;
|
||||||
uid?: string;
|
uid?: string;
|
||||||
}) {
|
}) {
|
||||||
const { resource, api, app, uid } = props;
|
const { status, resource, api, app, uid } = props;
|
||||||
const inviteAccept = useInviteAccept(resource, api, app, uid);
|
const inviteAccept = useInviteAccept(resource, api, app, uid);
|
||||||
|
const set = useGroupState(s => s.set);
|
||||||
|
|
||||||
const inviteDecline = useCallback(async () => {
|
const inviteDecline = useCallback(async () => {
|
||||||
if (!(app && uid)) {
|
if (!(app && uid)) {
|
||||||
@ -213,15 +214,18 @@ function InviteActions(props: {
|
|||||||
await api.invite.decline(app, uid);
|
await api.invite.decline(app, uid);
|
||||||
}, [app, uid]);
|
}, [app, uid]);
|
||||||
|
|
||||||
const hideJoin = useCallback(async () => {
|
const hideJoin = useCallback(async (e) => {
|
||||||
await api.groups.hide(resource);
|
if(status?.progress === 'done') {
|
||||||
}, [api, resource]);
|
set(s => {
|
||||||
|
delete s.pendingJoin[resource]
|
||||||
const { status } = props;
|
});
|
||||||
if (status) {
|
e.stopPropagation();
|
||||||
if(status.progress === 'done') {
|
return;
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
await api.groups.hide(resource);
|
||||||
|
}, [api, resource, status]);
|
||||||
|
|
||||||
|
if (status) {
|
||||||
return (
|
return (
|
||||||
<Row gapX={2} alignItems="center" height={4}>
|
<Row gapX={2} alignItems="center" height={4}>
|
||||||
<StatelessAsyncButton
|
<StatelessAsyncButton
|
||||||
@ -229,7 +233,7 @@ function InviteActions(props: {
|
|||||||
backgroundColor="white"
|
backgroundColor="white"
|
||||||
onClick={hideJoin}
|
onClick={hideJoin}
|
||||||
>
|
>
|
||||||
Cancel
|
{status?.progress === 'done' ? 'Dismiss' : 'Cancel'}
|
||||||
</StatelessAsyncButton>
|
</StatelessAsyncButton>
|
||||||
</Row>
|
</Row>
|
||||||
);
|
);
|
||||||
|
@ -31,7 +31,7 @@ return;
|
|||||||
|
|
||||||
const action = props.owner ? 'Archive' : 'Leave';
|
const action = props.owner ? 'Archive' : 'Leave';
|
||||||
const description = props.owner
|
const description = props.owner
|
||||||
? 'Permanently delete this group. (All current members will no longer see this group.)'
|
? 'Permanently archive this group. (All current members will no longer see this group.)'
|
||||||
: 'You can rejoin if it is an open group, or if you are reinvited';
|
: 'You can rejoin if it is an open group, or if you are reinvited';
|
||||||
|
|
||||||
const icon = props.owner ? 'X' : 'LogOut';
|
const icon = props.owner ? 'X' : 'LogOut';
|
||||||
|
@ -220,28 +220,24 @@ const header = ({ children, depth, ...rest }) => {
|
|||||||
const level = depth;
|
const level = depth;
|
||||||
const inner =
|
const inner =
|
||||||
level === 1 ? (
|
level === 1 ? (
|
||||||
<H1 display='block'>{children}</H1>
|
<H1 display="block">{children}</H1>
|
||||||
) : level === 2 ? (
|
) : level === 2 ? (
|
||||||
<H2 display='block'>{children}</H2>
|
<H2 display="block">{children}</H2>
|
||||||
) : level === 3 ? (
|
) : level === 3 ? (
|
||||||
<H3 display='block'>{children}</H3>
|
<H3 display="block">{children}</H3>
|
||||||
) : (
|
) : (
|
||||||
<H4 display='block'>{children}</H4>
|
<H4 display="block">{children}</H4>
|
||||||
);
|
|
||||||
return (
|
|
||||||
<Box {...rest} mt={2} mb={4}>
|
|
||||||
{inner}
|
|
||||||
</Box>
|
|
||||||
);
|
);
|
||||||
|
return <Box {...rest}>{inner}</Box>;
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderers = {
|
const renderers = {
|
||||||
heading: header,
|
heading: header,
|
||||||
break: () => {
|
break: () => {
|
||||||
return <Box display='block' width='100%' height={2}></Box>
|
return <Box display="block" width="100%" height={2}></Box>;
|
||||||
},
|
},
|
||||||
thematicBreak: () => {
|
thematicBreak: () => {
|
||||||
return <Box display='block' width='100%' height={2}></Box>
|
return <Box display="block" width="100%" height={2}></Box>;
|
||||||
},
|
},
|
||||||
inlineCode: ({ language, value }) => {
|
inlineCode: ({ language, value }) => {
|
||||||
return (
|
return (
|
||||||
@ -258,22 +254,26 @@ const renderers = {
|
|||||||
},
|
},
|
||||||
strong: ({ children }) => {
|
strong: ({ children }) => {
|
||||||
return (
|
return (
|
||||||
<Text fontWeight="bold" lineHeight='1'>
|
<Text fontWeight="bold" lineHeight="1">
|
||||||
{children}
|
{children}
|
||||||
</Text>
|
</Text>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
emphasis: ({ children }) => {
|
emphasis: ({ children }) => {
|
||||||
return (
|
return (
|
||||||
<Text fontStyle="italic" fontSize={1} lineHeight={'20px'}>
|
<Text fontStyle="italic" fontSize={1} lineHeight="tall">
|
||||||
{children}
|
{children}
|
||||||
</Text>
|
</Text>
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
blockquote: ({ children, tall, ...rest }) => {
|
blockquote: ({ children, depth, tall, ...rest }) => {
|
||||||
|
if (depth > 1) {
|
||||||
|
return children;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Text
|
<Text
|
||||||
lineHeight="20px"
|
lineHeight="tall"
|
||||||
display="block"
|
display="block"
|
||||||
borderLeft="1px solid"
|
borderLeft="1px solid"
|
||||||
color="black"
|
color="black"
|
||||||
@ -287,7 +287,7 @@ const renderers = {
|
|||||||
},
|
},
|
||||||
paragraph: ({ children }) => {
|
paragraph: ({ children }) => {
|
||||||
return (
|
return (
|
||||||
<Text fontSize={1} lineHeight={'20px'}>
|
<Text fontSize={1} lineHeight="tall">
|
||||||
{children}
|
{children}
|
||||||
</Text>
|
</Text>
|
||||||
);
|
);
|
||||||
@ -329,7 +329,13 @@ const renderers = {
|
|||||||
},
|
},
|
||||||
link: (props) => {
|
link: (props) => {
|
||||||
return (
|
return (
|
||||||
<Anchor href={props.url} borderBottom="1" color="black" target="_blank">
|
<Anchor
|
||||||
|
display="inline"
|
||||||
|
href={props.url}
|
||||||
|
borderBottom="1"
|
||||||
|
color="black"
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
{props.children}
|
{props.children}
|
||||||
</Anchor>
|
</Anchor>
|
||||||
);
|
);
|
||||||
@ -342,7 +348,7 @@ const renderers = {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
'graph-mention': ({ ship }) => <Mention api={{} as any} ship={ship} />,
|
'graph-mention': ({ ship }) => <Mention api={{} as any} ship={ship} />,
|
||||||
'image': ({ url }) => (
|
image: ({ url }) => (
|
||||||
<Box mt="1" mb="2" flexShrink={0}>
|
<Box mt="1" mb="2" flexShrink={0}>
|
||||||
<RemoteContent key={url} url={url} />
|
<RemoteContent key={url} url={url} />
|
||||||
</Box>
|
</Box>
|
||||||
@ -366,15 +372,26 @@ const renderers = {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
root: ({ tall, children }) =>
|
root: ({ tall, children }) =>
|
||||||
tall
|
tall ? (
|
||||||
? <Box
|
<Box
|
||||||
display='grid'
|
display="grid"
|
||||||
style={{ 'gridTemplateColumns': 'minmax(0,1fr)', 'rowGap': '1rem' }}
|
style={{ gridTemplateColumns: 'minmax(0,1fr)', rowGap: '1rem' }}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</Box>
|
</Box>
|
||||||
: <Box>{children}</Box>,
|
) : (
|
||||||
text: ({ value }) => value,
|
<Box>{children}</Box>
|
||||||
|
),
|
||||||
|
text: ({ value }) => (
|
||||||
|
<>
|
||||||
|
{value.split('\n').map((v, idx) => (
|
||||||
|
<React.Fragment key={idx}>
|
||||||
|
{idx !== 0 ? <br /> : null}
|
||||||
|
{v}
|
||||||
|
</React.Fragment>
|
||||||
|
))}
|
||||||
|
</>
|
||||||
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
export function Graphdown<T extends {} = {}>(
|
export function Graphdown<T extends {} = {}>(
|
||||||
@ -390,7 +407,13 @@ export function Graphdown<T extends {} = {}>(
|
|||||||
const Renderer = renderers[ast.type] ?? (() => `unknown element: ${type}`);
|
const Renderer = renderers[ast.type] ?? (() => `unknown element: ${type}`);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Renderer transcluded={transcluded} depth={depth} {...rest} {...nodeRest} tall={tall}>
|
<Renderer
|
||||||
|
transcluded={transcluded}
|
||||||
|
depth={depth}
|
||||||
|
{...rest}
|
||||||
|
{...nodeRest}
|
||||||
|
tall={tall}
|
||||||
|
>
|
||||||
{children.map((c) => (
|
{children.map((c) => (
|
||||||
<Graphdown
|
<Graphdown
|
||||||
transcluded={transcluded}
|
transcluded={transcluded}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import remark from 'remark';
|
import remark from 'remark';
|
||||||
import RemarkDisableTokenizers from 'remark-disable-tokenizers';
|
import RemarkDisableTokenizers from 'remark-disable-tokenizers';
|
||||||
|
import RemarkBreaks from 'remark-breaks';
|
||||||
|
|
||||||
const DISABLED_BLOCK_TOKENS = [
|
const DISABLED_BLOCK_TOKENS = [
|
||||||
'indentedCode',
|
'indentedCode',
|
||||||
@ -12,7 +13,7 @@ const DISABLED_BLOCK_TOKENS = [
|
|||||||
'table',
|
'table',
|
||||||
];
|
];
|
||||||
|
|
||||||
const DISABLED_INLINE_TOKENS = ['autoLink', 'url', 'email', 'reference'];
|
const DISABLED_INLINE_TOKENS = ['autoLink', 'url', 'email', 'reference', 'html'];
|
||||||
|
|
||||||
const tallParser = remark().freeze();
|
const tallParser = remark().freeze();
|
||||||
|
|
||||||
@ -27,6 +28,7 @@ const wideParser = remark()
|
|||||||
inline: DISABLED_INLINE_TOKENS,
|
inline: DISABLED_INLINE_TOKENS,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
RemarkBreaks,
|
||||||
])
|
])
|
||||||
.freeze();
|
.freeze();
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import {
|
|||||||
import { Enc, GroupPolicy } from '@urbit/api';
|
import { Enc, GroupPolicy } from '@urbit/api';
|
||||||
import { Form, Formik, FormikHelpers } from 'formik';
|
import { Form, Formik, FormikHelpers } from 'formik';
|
||||||
import React, { ReactElement, useCallback } from 'react';
|
import React, { ReactElement, useCallback } from 'react';
|
||||||
import { useHistory } from 'react-router-dom';
|
import { RouteComponentProps, useHistory } from 'react-router-dom';
|
||||||
import * as Yup from 'yup';
|
import * as Yup from 'yup';
|
||||||
import GlobalApi from '~/logic/api/global';
|
import GlobalApi from '~/logic/api/global';
|
||||||
import { useWaitForProps } from '~/logic/lib/useWaitForProps';
|
import { useWaitForProps } from '~/logic/lib/useWaitForProps';
|
||||||
@ -31,7 +31,7 @@ interface NewGroupProps {
|
|||||||
api: GlobalApi;
|
api: GlobalApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function NewGroup(props: NewGroupProps): ReactElement {
|
export function NewGroup(props: NewGroupProps & RouteComponentProps): ReactElement {
|
||||||
const { api } = props;
|
const { api } = props;
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const initialValues: FormSchema = {
|
const initialValues: FormSchema = {
|
||||||
|
Loading…
Reference in New Issue
Block a user