Skip to content

Commit

Permalink
bark: clear bark data on-opt-out
Browse files Browse the repository at this point in the history
We shouldn't leave stale data in the mailchimp database, but rather wipe
any data we've collected for users that are explicitly opting out.
  • Loading branch information
Fang- committed Oct 5, 2023
1 parent 7bd7e4f commit 245503f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 8 additions & 2 deletions desk/app/bark.hoon
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,13 @@
%bark-remove-recipient
=+ !<(=ship vase)
?> =(src.bowl ship)
`this(recipients (~(del in recipients) ship))
:_ this(recipients (~(del in recipients) ship))
:_ ~
:* %pass /save-summary/(scot %p src.bowl)/(scot %da now.bowl)
%arvo %k %fard
%landscape %save-summary %noun
!>(`[tlon.api mailchimp.api src.bowl %wipe ~])
==
::
%bark-generate-summaries
?> =(src.bowl our.bowl)
Expand Down Expand Up @@ -107,7 +113,7 @@
== ==
vase
?~ result
`this(recipients (~(del in recipients) src.bowl))
$(mark %bark-remove-recipient, vase !>(src.bowl))
::TODO maybe drop the result (or re-request) if the timestamp is too old?
:_ this
:~ :* %pass /save-summary/(scot %p src.bowl)/(scot %da requested.u.result)
Expand Down
4 changes: 4 additions & 0 deletions desk/ted/save-summary.hoon
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
::
$= summary
$% [%life [sen=@ud rec=@ud gro=@t] [dms=@ud etc=@ud group=@t chat=@t]]
[%wipe ~]
==
==
=/ args !<([~ arg-mold] arg)
Expand Down Expand Up @@ -45,6 +46,9 @@
=; vars=(map @t json)
!>(`[mailchimp.args u.mail vars])
%- ~(gas by *(map @t json))
=? summary.args ?=(%wipe -.summary.args)
[%life [0 0 ''] [0 0 '' '']]
?> ?=(%life -.summary.args)
=, summary.args
:~ ['MSGS_SENT' (numb:enjs:format sen)]
['MSGS_RECD' (numb:enjs:format rec)]
Expand Down

0 comments on commit 245503f

Please sign in to comment.