From f254e9c294a124f3c566afeaa3b840f661298760 Mon Sep 17 00:00:00 2001 From: fang Date: Wed, 4 Oct 2023 10:55:20 +0200 Subject: [PATCH] growl: don't fumble the activity logging consent Previous logic for reading %settings-event facts was a little to eager in declaring explicit non-consent. It would also set the flag to false in cases where we received updates not matching what we were looking for. Now, it's not entirely certain that this was a problem, but we did observe "disabled growl" on ships that had the setting toggle on the frontend set to true, and this seemed like the only viable cause of that. We also update +on-load to re-set the flag from the current settings value, to correct any lingering mismatching states. --- desk/app/growl.hoon | 58 ++++++++++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 24 deletions(-) diff --git a/desk/app/growl.hoon b/desk/app/growl.hoon index 998c340e..9a328bca 100644 --- a/desk/app/growl.hoon +++ b/desk/app/growl.hoon @@ -3,15 +3,12 @@ :: |% +$ card card:agent:gall -+$ versioned-state - $% state-0 - == -+$ state-0 [%0 enabled=_| bark-host=_~rilfet-palsum] ++$ state-1 [%1 enabled=_| bark-host=_~rilfet-palsum] -- :: :: This agent should eventually go into landscape :: -=| state-0 +=| state-1 =* state - %- agent:dbug %+ verb | @@ -42,6 +39,26 @@ 'logActivity' [%b |] :: +++ on-save !>(state) +++ on-load + |= old-state=vase + |^ ^- (quip card _this) + =+ !<(old=versioned-state old-state) + ?- -.old + %0 + =^ caz this on-init :: %0 dropped the ball, re-initialize + :_ this + :_ caz + [%pass /settings %agent [our.bowl %settings] %leave ~] + :: + %1 + [~ this(state old)] + == + :: + +$ versioned-state $%(state-0 state-1) + +$ state-0 [%0 enabled=_| bark-host=_~rilfet-palsum] + -- +:: ++ on-poke |= [=mark =vase] ^- (quip card _this) @@ -91,17 +108,19 @@ %fact ?. =(%settings-event p.cage.sign) (on-agent:def wire sign) =+ !<(=event:settings q.cage.sign) - =/ new=? - =; =val:settings - ?:(?=(%b -.val) p.val |) - ?+ event b+| - [%put-bucket %groups %groups *] (~(gut by bucket.event) 'logActivity' b+|) - [%del-bucket %groups %groups] b+| - [%put-entry %groups %groups %'logActivity' *] val.event - [%del-entry %groups %groups %'logActivity'] b+| + =/ new=(unit ?) + =; val=(unit val:settings) + ?~ val ~ + `?:(?=(%b -.u.val) p.u.val |) + ?+ event ~ + [%put-bucket %groups %groups *] `(~(gut by bucket.event) 'logActivity' b+|) + [%del-bucket %groups %groups] `b+| + [%put-entry %groups %groups %'logActivity' *] `val.event + [%del-entry %groups %groups %'logActivity'] `b+| == - ?: =(new enabled) [~ this] - (on-poke ?:(new %enable %disable) !>(~)) + ?~ new [~ this] + ?: =(u.new enabled) [~ this] + (on-poke ?:(u.new %enable %disable) !>(~)) == :: ++ on-watch on-watch:def @@ -111,15 +130,6 @@ ++ on-leave |= =path `this -++ on-save !>(state) -++ on-load - |= old-state=vase - ^- (quip card _this) - =/ old !<(versioned-state old-state) - ?- -.old - %0 - `this(state old) - == ++ on-arvo on-arvo:def ++ on-peek on-peek:def --