mirror of
https://github.com/urbit/shrub.git
synced 2024-12-22 10:21:31 +03:00
metadata-hooks: do not request preview if we already have it
This commit is contained in:
parent
b0597e32d3
commit
a5925a4842
@ -181,6 +181,8 @@
|
||||
=/ rid=resource
|
||||
(de-path:resource t.path)
|
||||
=/ prev=(unit group-preview:metadata)
|
||||
?^ (peek-metadatum:met %groups rid)
|
||||
(some (get-preview:met rid))
|
||||
(~(get by previews) rid)
|
||||
:_ this
|
||||
?~ prev
|
||||
|
@ -42,32 +42,13 @@
|
||||
=+ !<(=hook-update:store vase)
|
||||
?. ?=(%req-preview -.hook-update)
|
||||
(on-poke:def mark vase)
|
||||
=* rid group.hook-update
|
||||
|^
|
||||
?> =(entity.rid our.bowl)
|
||||
?> (can-join:grp rid src.bowl)
|
||||
=/ members
|
||||
~(wyt in (members:grp rid))
|
||||
=/ =metadatum:store
|
||||
%- need
|
||||
%+ mate (peek-metadatum:met %groups rid)
|
||||
(peek-metadatum:met %graph rid)
|
||||
?> =(entity.group.hook-update our.bowl)
|
||||
=/ =group-preview:store
|
||||
(get-preview:met group.hook-update)
|
||||
:_ this
|
||||
=; =cage
|
||||
[%pass / %agent [src.bowl %metadata-pull-hook] %poke cage]~
|
||||
:- %metadata-hook-update
|
||||
!> ^- hook-update:store
|
||||
[%preview rid channels members channel-count metadatum]
|
||||
::
|
||||
++ channels
|
||||
%- ~(gas by *associations:store)
|
||||
%+ skim ~(tap by (app-metadata-for-group:met rid %graph))
|
||||
|=([=md-resource:store group=resource =metadatum:store] preview.metadatum)
|
||||
::
|
||||
++ channel-count
|
||||
~(wyt by (app-metadata-for-group:met rid %graph))
|
||||
--
|
||||
|
||||
=- [%pass / %agent [src.bowl %metadata-pull-hook] %poke -]~
|
||||
metadata-hook-update+!>(`hook-update:store`[%preview group-preview])
|
||||
::
|
||||
++ on-agent on-agent:def
|
||||
++ on-watch on-watch:def
|
||||
++ on-leave on-leave:def
|
||||
|
@ -1,9 +1,33 @@
|
||||
:: metadata: helpers for getting data from the metadata-store
|
||||
::
|
||||
/- store=metadata-store
|
||||
/+ resource
|
||||
/+ resource, grpl=group
|
||||
::
|
||||
|_ =bowl:gall
|
||||
+* grp ~(. grpl bowl)
|
||||
::
|
||||
++ get-preview
|
||||
|= rid=resource
|
||||
|^ ^- group-preview:store
|
||||
?> (can-join:grp rid src.bowl)
|
||||
=/ members
|
||||
~(wyt in (members:grp rid))
|
||||
=/ =metadatum:store
|
||||
%- need
|
||||
%+ mate (peek-metadatum %groups rid)
|
||||
(peek-metadatum %graph rid)
|
||||
[rid channels members channel-count metadatum]
|
||||
::
|
||||
++ channels
|
||||
%- ~(gas by *associations:store)
|
||||
%+ scag 5
|
||||
%+ skim ~(tap by (app-metadata-for-group rid %graph))
|
||||
|=([=md-resource:store group=resource =metadatum:store] preview.metadatum)
|
||||
::
|
||||
++ channel-count
|
||||
~(wyt by (app-metadata-for-group rid %graph))
|
||||
--
|
||||
::
|
||||
++ resource-for-update
|
||||
|= =vase
|
||||
^- (list resource)
|
||||
|
Loading…
Reference in New Issue
Block a user