From 245503f5e7552c82cacd6ec685871b414ae19da5 Mon Sep 17 00:00:00 2001 From: fang Date: Thu, 5 Oct 2023 10:24:31 +0200 Subject: [PATCH] bark: clear bark data on-opt-out 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. --- desk/app/bark.hoon | 10 ++++++++-- desk/ted/save-summary.hoon | 4 ++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/desk/app/bark.hoon b/desk/app/bark.hoon index f70599fc..bdebea42 100644 --- a/desk/app/bark.hoon +++ b/desk/app/bark.hoon @@ -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) @@ -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) diff --git a/desk/ted/save-summary.hoon b/desk/ted/save-summary.hoon index 675301e2..0f569d49 100644 --- a/desk/ted/save-summary.hoon +++ b/desk/ted/save-summary.hoon @@ -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) @@ -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)]