Skip to content

Commit

Permalink
growl: don't fumble the activity logging consent
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Fang- committed Oct 4, 2023
1 parent 150ad47 commit f254e9c
Showing 1 changed file with 34 additions and 24 deletions.
58 changes: 34 additions & 24 deletions desk/app/growl.hoon
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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
--

0 comments on commit f254e9c

Please sign in to comment.