diff --git a/pkg/arvo/app/contact-hook.hoon b/pkg/arvo/app/contact-hook.hoon index 956f894b7..ad7b53c8c 100644 --- a/pkg/arvo/app/contact-hook.hoon +++ b/pkg/arvo/app/contact-hook.hoon @@ -138,6 +138,7 @@ ^- (list card) :: local ?: (team:title our.bol src.bol) + ?. (~(has by synced) path) ~ =/ shp ?:(=(path /~/default) our.bol (~(got by synced) path)) =/ appl ?:(=(shp our.bol) %contact-store %contact-hook) [%pass / %agent [shp appl] %poke %contact-action !>(act)]~ @@ -161,7 +162,9 @@ [~ state] =. synced (~(put by synced) path.act our.bol) :_ state - [%pass contact-path %agent [our.bol %contact-store] %watch contact-path]~ + :~ [%pass contact-path %agent [our.bol %contact-store] %watch contact-path] + [%give %fact ~ %contact-hook-update !>([%initial synced])] + == :: %add-synced ?> (team:title our.bol src.bol) @@ -169,7 +172,9 @@ =. synced (~(put by synced) path.act ship.act) =/ contact-path [%contacts path.act] :_ state - [%pass contact-path %agent [ship.act %contact-hook] %watch contact-path]~ + :~ [%pass contact-path %agent [ship.act %contact-hook] %watch contact-path] + [%give %fact ~ %contact-hook-update !>([%initial synced])] + == :: %remove =/ ship (~(get by synced) path.act) @@ -180,13 +185,17 @@ %- zing :~ (pull-wire [%contacts path.act]) [%give %kick ~[[%contacts path.act]] ~]~ + [%give %fact ~ %contact-hook-update !>([%initial synced])]~ == ?. |(=(u.ship src.bol) (team:title our.bol src.bol)) :: if neither ship = source or source = us, do nothing [~ state] :: delete a foreign ship's path - :- (pull-wire [%contacts path.act]) - state(synced (~(del by synced) path.act)) + :_ state(synced (~(del by synced) path.act)) + %- zing + :~ (pull-wire [%contacts path.act]) + [%give %fact ~ %contact-hook-update !>([%initial synced])]~ + == == :: ++ watch-contacts diff --git a/pkg/arvo/lib/contact-json.hoon b/pkg/arvo/lib/contact-json.hoon index c212e2708..cca3aa70e 100644 --- a/pkg/arvo/lib/contact-json.hoon +++ b/pkg/arvo/lib/contact-json.hoon @@ -1,10 +1,21 @@ -/- *contact-view +/- *contact-view, *contact-hook |% ++ nu :: parse number as hex |= jon/json ?> ?=({$s *} jon) (rash p.jon hex) :: +++ hook-update-to-json + |= upd=contact-hook-update + =, enjs:format + ^- json + %+ frond %contact-hook-update + %- pairs + %+ turn ~(tap by synced.upd) + |= [pax=^path shp=^ship] + ^- [cord json] + [(spat pax) s+(scot %p shp)] +:: ++ rolodex-to-json |= rolo=rolodex =, enjs:format diff --git a/pkg/arvo/mar/contact/hook-update.hoon b/pkg/arvo/mar/contact/hook-update.hoon new file mode 100644 index 000000000..a1bdebd7b --- /dev/null +++ b/pkg/arvo/mar/contact/hook-update.hoon @@ -0,0 +1,13 @@ +/+ *contact-json +|_ upd=contact-hook-update +++ grow + |% + ++ json (hook-update-to-json upd) + -- +:: +++ grab + |% + ++ noun contact-hook-update + -- +:: +-- diff --git a/pkg/interface/groups/src/js/subscription.js b/pkg/interface/groups/src/js/subscription.js index aa0d23730..c7dc1b748 100644 --- a/pkg/interface/groups/src/js/subscription.js +++ b/pkg/interface/groups/src/js/subscription.js @@ -49,9 +49,6 @@ export class Subscription { store.handleEvent(diff); } - handleEvent(diff) { - store.handleEvent(diff); - } } export let subscription = new Subscription();