Merge pull request #2974 from urbit/la/spa-invites

invites: fixed %initial
This commit is contained in:
matildepark 2020-06-04 17:41:52 -04:00 committed by GitHub
commit e88346ee7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 6 additions and 79 deletions

View File

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

View File

@ -4,6 +4,7 @@ export default class InviteReducer {
reduce(json, state) {
const data = _.get(json, 'invite-update', false);
if (data) {
console.log(data);
this.initial(data, state);
this.create(data, state);
this.delete(data, state);

View File

@ -5,7 +5,7 @@ export default class ChatSubscription extends BaseSubscription {
this.subscribe('/primary', 'chat-view');
setTimeout(() => {
this.subscribe('/synced', 'chat-hook');
this.subscribe('/primary', 'invite-view');
this.subscribe('/all', 'invite-store');
this.subscribe('/all', 'permission-store');
this.subscribe('/primary', 'contact-view');
this.subscribe('/app-name/chat', 'metadata-store');

View File

@ -2,7 +2,7 @@ import BaseSubscription from './base';
export default class GlobalSubscription extends BaseSubscription {
start() {
this.subscribe('/primary', 'invite-view');
this.subscribe('/all', 'invite-store');
this.subscribe('/app-name/contacts', 'metadata-store');
}
}

View File

@ -6,7 +6,7 @@ export default class GroupsSubscription extends BaseSubscription {
this.subscribe('/all', 'group-store');
this.subscribe('/all', 'metadata-store');
this.subscribe('/synced', 'contact-hook');
this.subscribe('/primary', 'invite-view');
this.subscribe('/all', 'invite-store');
this.subscribe('/all', 's3-store');
}
}

View File

@ -4,7 +4,7 @@ export default class LinksSubscription extends BaseSubscription {
start() {
this.subscribe('/all', 'group-store');
this.subscribe('/primary', 'contact-view');
this.subscribe('/primary', 'invite-view');
this.subscribe('/all', 'invite-store');
this.subscribe('/app-name/link', 'metadata-store');
this.subscribe('/app-name/contacts', 'metadata-store');
this.subscribe('/listening', 'link-listen-hook');

View File

@ -5,7 +5,7 @@ export default class PublishSubscription extends BaseSubscription {
this.subscribe('/primary', 'publish');
this.subscribe('/all', 'group-store');
this.subscribe('/primary', 'contact-view');
this.subscribe('/primary', 'invite-view');
this.subscribe('/all', 'invite-store');
this.subscribe('/all', 'permission-store');
this.subscribe('/app-name/contacts', 'metadata-store');
}