mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-13 08:38:43 +03:00
metadata-hooks: store previews
This commit is contained in:
parent
42e7746b9c
commit
de33d3d572
@ -16,6 +16,8 @@
|
|||||||
%metadata-update
|
%metadata-update
|
||||||
%metadata-push-hook
|
%metadata-push-hook
|
||||||
==
|
==
|
||||||
|
+$ state-zero
|
||||||
|
[%0 previews=(map resource group-preview)]
|
||||||
::
|
::
|
||||||
--
|
--
|
||||||
::
|
::
|
||||||
@ -25,6 +27,8 @@
|
|||||||
^- agent:gall
|
^- agent:gall
|
||||||
%- (agent:pull-hook config)
|
%- (agent:pull-hook config)
|
||||||
^- (pull-hook:pull-hook config)
|
^- (pull-hook:pull-hook config)
|
||||||
|
=| state-zero
|
||||||
|
=* state -
|
||||||
|_ =bowl:gall
|
|_ =bowl:gall
|
||||||
+* this .
|
+* this .
|
||||||
def ~(. (default-agent this %|) bowl)
|
def ~(. (default-agent this %|) bowl)
|
||||||
@ -32,21 +36,31 @@
|
|||||||
met ~(. mdl bowl)
|
met ~(. mdl bowl)
|
||||||
::
|
::
|
||||||
++ on-init on-init:def
|
++ on-init on-init:def
|
||||||
++ on-save !>(~)
|
++ on-save !>(state)
|
||||||
++ on-load on-load:def
|
++ on-load
|
||||||
|
|= =vase
|
||||||
|
=+ !<(old=state-zero vase)
|
||||||
|
`this(state old)
|
||||||
|
::
|
||||||
++ on-poke on-poke:def
|
++ on-poke on-poke:def
|
||||||
++ on-agent
|
++ on-agent
|
||||||
|= [=wire =sign:agent:gall]
|
|= [=wire =sign:agent:gall]
|
||||||
?. ?=([%preview @ @ @ ~] wire)
|
?. ?=([%preview @ @ @ ~] wire)
|
||||||
(on-agent:def wire sign)
|
(on-agent:def wire sign)
|
||||||
:_ this
|
=/ rid=resource
|
||||||
?+ -.sign ~
|
(de-path:resource t.wire)
|
||||||
|
?+ -.sign `this
|
||||||
%fact
|
%fact
|
||||||
|
?> =(%metadata-update p.cage.sign)
|
||||||
|
=+ !<(upd=metadata-update q.cage.sign)
|
||||||
|
?> ?=(%preview -.upd)
|
||||||
|
:_ this(previews (~(put by previews) rid +.upd))
|
||||||
:~ [%give %fact ~[wire] cage.sign]
|
:~ [%give %fact ~[wire] cage.sign]
|
||||||
[%give %kick ~[wire] ~]
|
[%give %kick ~[wire] ~]
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
%watch-ack
|
%watch-ack
|
||||||
|
:_ this
|
||||||
?~ p.sign ~
|
?~ p.sign ~
|
||||||
:~ [%give %fact ~[wire] tang+!>(u.p.sign)]
|
:~ [%give %fact ~[wire] tang+!>(u.p.sign)]
|
||||||
[%give %kick ~[wire] ~]
|
[%give %kick ~[wire] ~]
|
||||||
@ -60,28 +74,20 @@
|
|||||||
(on-watch:def path)
|
(on-watch:def path)
|
||||||
=/ rid=resource
|
=/ rid=resource
|
||||||
(de-path:resource t.path)
|
(de-path:resource t.path)
|
||||||
|
=/ prev=(unit group-preview)
|
||||||
|
(~(get by previews) rid)
|
||||||
:_ this
|
:_ this
|
||||||
|
?^ prev
|
||||||
|
:~ [%give %fact ~ metadata-update+!>([%preview u.prev])]
|
||||||
|
[%give %kick ~ ~]
|
||||||
|
==
|
||||||
=/ =dock
|
=/ =dock
|
||||||
[entity.rid %metadata-push-hook]
|
[entity.rid %metadata-push-hook]
|
||||||
:~ [%pass path %arvo %b %wait (add now.bowl ~s20)]
|
[%pass path %agent dock %watch path]~
|
||||||
[%pass path %agent dock %watch path]
|
|
||||||
==
|
|
||||||
::
|
::
|
||||||
++ on-leave on-leave:def
|
++ on-leave on-leave:def
|
||||||
++ on-peek on-peek:def
|
++ on-peek on-peek:def
|
||||||
++ on-arvo
|
++ on-arvo on-arvo:def
|
||||||
|= [=wire =sign-arvo]
|
|
||||||
?. ?=([%preview @ @ @ ~] wire)
|
|
||||||
(on-arvo:def wire sign-arvo)
|
|
||||||
=/ rid=resource
|
|
||||||
(de-path:resource t.wire)
|
|
||||||
=/ =dock
|
|
||||||
[entity.rid %metadata-push-hook]
|
|
||||||
:_ this
|
|
||||||
?. (~(has by wex.bowl) [wire dock]) ~
|
|
||||||
:~ [%pass wire %agent dock %leave ~]
|
|
||||||
[%give %kick ~[wire] ~]
|
|
||||||
==
|
|
||||||
::
|
::
|
||||||
++ on-fail on-fail:def
|
++ on-fail on-fail:def
|
||||||
++ on-pull-nack
|
++ on-pull-nack
|
||||||
|
@ -59,13 +59,12 @@
|
|||||||
:- %metadata-update
|
:- %metadata-update
|
||||||
!> ^- metadata-update
|
!> ^- metadata-update
|
||||||
[%preview rid channels members channel-count metadata]
|
[%preview rid channels members channel-count metadata]
|
||||||
:: TODO: rank by popularity
|
::
|
||||||
:: how tho, if the group owner isn't in some graphs
|
|
||||||
++ channels
|
++ channels
|
||||||
%- ~(gas by *associations)
|
%- ~(gas by *associations)
|
||||||
%+ skim ~(tap by (app-metadata-for-group:met rid %graph))
|
%+ skim ~(tap by (app-metadata-for-group:met rid %graph))
|
||||||
|=([=md-resource group=resource =metadata] preview.metadata)
|
|=([=md-resource group=resource =metadata] preview.metadata)
|
||||||
|
::
|
||||||
++ channel-count
|
++ channel-count
|
||||||
~(wyt by (app-metadata-for-group:met rid %graph))
|
~(wyt by (app-metadata-for-group:met rid %graph))
|
||||||
--
|
--
|
||||||
|
Loading…
Reference in New Issue
Block a user