mirror of
https://github.com/urbit/shrub.git
synced 2024-12-01 14:42:02 +03:00
Merge pull request #2974 from urbit/la/spa-invites
invites: fixed %initial
This commit is contained in:
commit
e88346ee7c
@ -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
|
|
||||||
--
|
|
@ -4,6 +4,7 @@ export default class InviteReducer {
|
|||||||
reduce(json, state) {
|
reduce(json, state) {
|
||||||
const data = _.get(json, 'invite-update', false);
|
const data = _.get(json, 'invite-update', false);
|
||||||
if (data) {
|
if (data) {
|
||||||
|
console.log(data);
|
||||||
this.initial(data, state);
|
this.initial(data, state);
|
||||||
this.create(data, state);
|
this.create(data, state);
|
||||||
this.delete(data, state);
|
this.delete(data, state);
|
||||||
|
@ -5,7 +5,7 @@ export default class ChatSubscription extends BaseSubscription {
|
|||||||
this.subscribe('/primary', 'chat-view');
|
this.subscribe('/primary', 'chat-view');
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.subscribe('/synced', 'chat-hook');
|
this.subscribe('/synced', 'chat-hook');
|
||||||
this.subscribe('/primary', 'invite-view');
|
this.subscribe('/all', 'invite-store');
|
||||||
this.subscribe('/all', 'permission-store');
|
this.subscribe('/all', 'permission-store');
|
||||||
this.subscribe('/primary', 'contact-view');
|
this.subscribe('/primary', 'contact-view');
|
||||||
this.subscribe('/app-name/chat', 'metadata-store');
|
this.subscribe('/app-name/chat', 'metadata-store');
|
||||||
|
@ -2,7 +2,7 @@ import BaseSubscription from './base';
|
|||||||
|
|
||||||
export default class GlobalSubscription extends BaseSubscription {
|
export default class GlobalSubscription extends BaseSubscription {
|
||||||
start() {
|
start() {
|
||||||
this.subscribe('/primary', 'invite-view');
|
this.subscribe('/all', 'invite-store');
|
||||||
this.subscribe('/app-name/contacts', 'metadata-store');
|
this.subscribe('/app-name/contacts', 'metadata-store');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ export default class GroupsSubscription extends BaseSubscription {
|
|||||||
this.subscribe('/all', 'group-store');
|
this.subscribe('/all', 'group-store');
|
||||||
this.subscribe('/all', 'metadata-store');
|
this.subscribe('/all', 'metadata-store');
|
||||||
this.subscribe('/synced', 'contact-hook');
|
this.subscribe('/synced', 'contact-hook');
|
||||||
this.subscribe('/primary', 'invite-view');
|
this.subscribe('/all', 'invite-store');
|
||||||
this.subscribe('/all', 's3-store');
|
this.subscribe('/all', 's3-store');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ export default class LinksSubscription extends BaseSubscription {
|
|||||||
start() {
|
start() {
|
||||||
this.subscribe('/all', 'group-store');
|
this.subscribe('/all', 'group-store');
|
||||||
this.subscribe('/primary', 'contact-view');
|
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/link', 'metadata-store');
|
||||||
this.subscribe('/app-name/contacts', 'metadata-store');
|
this.subscribe('/app-name/contacts', 'metadata-store');
|
||||||
this.subscribe('/listening', 'link-listen-hook');
|
this.subscribe('/listening', 'link-listen-hook');
|
||||||
|
@ -5,7 +5,7 @@ export default class PublishSubscription extends BaseSubscription {
|
|||||||
this.subscribe('/primary', 'publish');
|
this.subscribe('/primary', 'publish');
|
||||||
this.subscribe('/all', 'group-store');
|
this.subscribe('/all', 'group-store');
|
||||||
this.subscribe('/primary', 'contact-view');
|
this.subscribe('/primary', 'contact-view');
|
||||||
this.subscribe('/primary', 'invite-view');
|
this.subscribe('/all', 'invite-store');
|
||||||
this.subscribe('/all', 'permission-store');
|
this.subscribe('/all', 'permission-store');
|
||||||
this.subscribe('/app-name/contacts', 'metadata-store');
|
this.subscribe('/app-name/contacts', 'metadata-store');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user