publish: fix remaining bugs with new groups

This commit is contained in:
Liam Fitzgerald 2020-06-15 18:10:09 +10:00
parent 0d80e4cf19
commit dea59807a7

View File

@ -7,7 +7,9 @@
*invite-store, *invite-store,
*metadata-store, *metadata-store,
*metadata-hook, *metadata-hook,
contact-view contact-view,
pull-hook,
push-hook
/+ *server, /+ *server,
*publish, *publish,
cram, cram,
@ -407,6 +409,8 @@
?- -.sin ?- -.sin
%poke-ack %poke-ack
?: ?=([%join-group @ @ ~] wir) ?: ?=([%join-group @ @ ~] wir)
?^ p.sin
(on-agent:def wir sin)
=/ =ship =/ =ship
(slav %p i.t.wir) (slav %p i.t.wir)
=^ cards state =^ cards state
@ -924,22 +928,22 @@
[~ state] [~ state]
:: ::
%accepted %accepted
?> ?=([%notebook @ ~] path.invite.upd) ?> ?=([@ @ *] path.invite.upd)
=/ book i.t.path.invite.upd =/ book i.t.path.invite.upd
=/ rid=resource
(de-path:resource path.invite.upd)
=/ group =/ group
(group-from-book path.invite.upd) (group-from-book notebook+book^~)
?^ group ?^ group
(subscribe-notebook ship.invite.upd book) (subscribe-notebook ship.invite.upd book)
=/ rid=resource
(de-path:resource ship+path.invite.upd)
=/ join-wire=wire =/ join-wire=wire
/join-group/[(scot %p ship.invite.upd)]/[book] /join-group/[(scot %p ship.invite.upd)]/[book]
=/ =cage =/ =cage
:- %group-action :- %group-update
!> ^- action:group-store !> ^- action:group-store
[%add-members rid (sy our.bol ~)] [%add-members rid (sy our.bol ~)]
:_ state :_ state
[%pass join-wire %agent [entity.rid %group-hook] %poke cage]~ [%pass join-wire %agent [entity.rid %group-push-hook] %poke cage]~
== ==
:: ::
++ subscribe-notebook ++ subscribe-notebook
@ -1054,12 +1058,12 @@
++ group-proxy-poke ++ group-proxy-poke
|= [who=ship act=action:group-store] |= [who=ship act=action:group-store]
^- card ^- card
[%pass / %agent [who %group-hook] %poke %group-action !>(act)] [%pass / %agent [who %group-push-hook] %poke %group-update !>(act)]
:: ::
++ group-hook-poke ++ group-pull-hook-poke
|= act=action:group-hook |= act=action:pull-hook
^- card ^- card
[%pass / %agent [our.bol %group-hook] %poke %group-hook-action !>(act)] [%pass / %agent [our.bol %group-pull-hook] %poke %pull-hook-action !>(act)]
:: ::
++ contact-view-poke ++ contact-view-poke
|= act=contact-view-action:contact-view |= act=contact-view-action:contact-view
@ -1110,7 +1114,7 @@
|= who=ship |= who=ship
=/ uid (sham %publish who book eny.bol) =/ uid (sham %publish who book eny.bol)
=/ inv=invite =/ inv=invite
:* our.bol %publish /notebook/[book] who :* our.bol %publish /(scot %p our.bol)/[book] who
(crip "invite for notebook {<our.bol>}/{(trip book)}") (crip "invite for notebook {<our.bol>}/{(trip book)}")
== ==
=/ act=invite-action [%invite /publish uid inv] =/ act=invite-action [%invite /publish uid inv]
@ -1142,7 +1146,7 @@
?^ grp ~ ?^ grp ~
=/ rid=resource =/ rid=resource
(de-path:resource group-path) (de-path:resource group-path)
:- (group-poke %add-group rid policy %.n) :- (group-poke %add-group rid policy %.y)
(generate-invites book (~(del in invitees.group) our.bol)) (generate-invites book (~(del in invitees.group) our.bol))
:: ::
++ handle-poke-fail ++ handle-poke-fail
@ -1689,20 +1693,28 @@
=/ rid=resource =/ rid=resource
[who.act book.act] [who.act book.act]
=/ =cage =/ =cage
:- %group-action :- %group-update
!> ^- action:group-store !> ^- action:group-store
[%add-members rid (sy our.bol ~)] [%add-members rid (sy our.bol ~)]
:_ state :_ state
[%pass join-wire %agent [who.act %group-hook] %poke cage]~ [%pass join-wire %agent [who.act %group-push-hook] %poke cage]~
:: %unsubscribe :: %unsubscribe
:: ::
%unsubscribe %unsubscribe
?> (team:title our.bol src.bol) ?> (team:title our.bol src.bol)
=/ wir=wire /subscribe/(scot %p who.act)/[book.act] =/ wir=wire /subscribe/(scot %p who.act)/[book.act]
=/ del=primary-delta [%del-book who.act book.act] =/ del=primary-delta [%del-book who.act book.act]
=/ book=notebook
(~(got by books) who.act book.act)
=/ rid=resource
(de-path:resource writers.book)
=/ =group
(need (scry-group:grup rid))
:_ state(books (~(del by books) who.act book.act)) :_ state(books (~(del by books) who.act book.act))
:~ `card`[%pass wir %agent [who.act %publish] %leave ~] :~ `card`[%pass wir %agent [who.act %publish] %leave ~]
`card`[%give %fact [/primary]~ %publish-primary-delta !>(del)] `card`[%give %fact [/primary]~ %publish-primary-delta !>(del)]
(group-proxy-poke who.act %remove-members rid (sy our.bol ~))
(group-poke %remove-group rid ~)
== ==
:: %read :: %read
:: ::
@ -1731,11 +1743,12 @@
?~ book ?~ book
~|("nonexistent notebook: {<book.act>}" !!) ~|("nonexistent notebook: {<book.act>}" !!)
:: ::
=* app-path writers.u.book =* old-group-path writers.u.book
=/ app-path /[(scot %p our.bol)]/[book.act]
=/ =metadata =/ =metadata
(need (metadata-scry app-path app-path)) (need (metadata-scry old-group-path app-path))
=/ old-rid=resource =/ old-rid=resource
(de-path:resource app-path) (de-path:resource old-group-path)
?< (is-managed:grup old-rid) ?< (is-managed:grup old-rid)
?~ target.act ?~ target.act
:: just create contacts object for group :: just create contacts object for group
@ -1925,7 +1938,7 @@
=/ rid=resource =/ rid=resource
(de-path:resource writers.data.del) (de-path:resource writers.data.del)
:_ state :_ state
:* (group-hook-poke [%add rid]) :* (group-pull-hook-poke [%add host.del rid])
(metadata-hook-poke [%add-synced host.del writers.data.del]) (metadata-hook-poke [%add-synced host.del writers.data.del])
cards cards
== ==