invites: fixed view bugs

This commit is contained in:
Logan Allen 2019-11-26 17:42:07 -08:00
parent a7fbed9350
commit 6ef2812cde

View File

@ -1,31 +1,24 @@
:: invite-view: provide a json interface to invite-store :: invite-view: provide a json interface to invite-store
:: ::
:: accepts subscriptions at the empty path. :: accepts subscriptions at the /primary path.
:: passes through all invites and their updates. :: passes through all invites and their updates.
:: only accepts subcriptions from the host's team. :: only accepts subcriptions from the host's team.
:: ::
::TODO could maybe use /lib/proxy-hook, be renamed invite-proxy-hook ::TODO could maybe use /lib/proxy-hook, be renamed invite-proxy-hook
:: ::
/+ *invite-json, default-agent, verb /+ *invite-json, default-agent
:: ::
|% |%
+$ state-0 [%0 ~]
::
+$ card card:agent:gall +$ card card:agent:gall
-- --
:: ::
:: =>
=| state-0 |%
=* state -
::
=> |%
++ watch-updates ++ watch-updates
|= our=ship |= our=ship
^- card ^- card
[%pass /store %agent [our %invite-store] %watch /updates] [%pass /store %agent [our %invite-store] %watch /updates]
-- --
::
%+ verb |
^- agent:gall ^- agent:gall
|_ =bowl:gall |_ =bowl:gall
+* this . +* this .
@ -35,17 +28,18 @@
^- (quip card _this) ^- (quip card _this)
[[(watch-updates our.bowl)]~ this] [[(watch-updates our.bowl)]~ this]
:: ::
++ on-save !>(state) ++ on-save on-save:def
++ on-load ++ on-load
|= old=vase |= old=vase
^- (quip card _this) ^- (quip card _this)
[~ this(state !<(state-0 old))] [~ this]
:: ::
++ on-watch ++ on-watch
|= =path |= =path
^- (quip card _this) ^- (quip card _this)
?> =(~ path)
?> (team:title our.bowl src.bowl) ?> (team:title our.bowl src.bowl)
?. =(/primary path)
(on-watch:def path)
:_ this :_ this
=/ =invites =/ =invites
.^(invites %gx /=invite-store/(scot %da now.bowl)/all/noun) .^(invites %gx /=invite-store/(scot %da now.bowl)/all/noun)
@ -54,7 +48,6 @@
++ on-agent ++ on-agent
|= [=wire =sign:agent:gall] |= [=wire =sign:agent:gall]
^- (quip card _this) ^- (quip card _this)
?. =(/store wire) (on-agent:def wire sign)
:_ this :_ this
?- -.sign ?- -.sign
%poke-ack ~|([dap.bowl %unexpected-poke-ack] !!) %poke-ack ~|([dap.bowl %unexpected-poke-ack] !!)
@ -64,7 +57,11 @@
%fact %fact
~| [dap.bowl %unexpected-fact-mark p.cage.sign] ~| [dap.bowl %unexpected-fact-mark p.cage.sign]
?> ?=(%invite-update p.cage.sign) ?> ?=(%invite-update p.cage.sign)
[%give %fact `/ %json !>((update-to-json !<(invite-update q.cage.sign)))]~ :~ :*
%give %fact
`/primary %json
!>((update-to-json !<(invite-update q.cage.sign)))
== ==
== ==
:: ::
++ on-poke on-poke:def ++ on-poke on-poke:def