POPIA toolkit part 1: privacy page, unsubscribe, WhatsApp STOP, data requests

- Privacy page: news opt-in per channel with history, download my data
  (JSON + PDF), correction and deletion requests
- Bulk messages are an Event update or News & announcements; news only
  reaches people who opted in, with unsubscribe links, one-click
  List-Unsubscribe headers and "Reply STOP" on WhatsApp
- WhatsApp STOP via WAWP's message webhook, checked against a secret in
  the webhook URL
- Sign-up opt-in box; existing accounts kept opted in and asked once
- Admin -> Data requests with 30-day due dates and a daily reminder job
- Deleting an account is a request; anonymising now covers attendees,
  form answers, consent details, payer details in provider payloads, etc.
- Unit tests (privacy.test.js) and e2e (privacy.spec.ts); docs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012mt6TCv85T9VKRq3cV7rXq
This commit is contained in:
2026-10-23 18:13:47 +02:00
co-authored by Claude Opus 5.5
parent f03b766b6e
commit 18f35ceeb3
47 changed files with 2871 additions and 143 deletions
@@ -0,0 +1,92 @@
import React from "react";
import { Megaphone, Download, PencilLine, Trash2, MailX, Inbox, Clock, ShieldCheck, MessageCircle } from "lucide-react";
import { GuideItem } from "@/components/shared/GuideItem";
import type { HelpContent } from "./types";
/** Help content for /dashboard/user/privacy (the person's own privacy centre). */
export const userPrivacyHelpContent: HelpContent = {
title: "Privacy",
subtitle: "What we send you, your data, and your rights under POPIA.",
tabs: [
{
key: "messages",
label: "Messages",
icon: Megaphone,
content: (
<div className="space-y-4">
<GuideItem icon={Megaphone} title="News & announcements" tone="brand">
Occasional messages about upcoming events. You only get them if you said yes — by email, WhatsApp or both. Untick a box to stop them.
</GuideItem>
<GuideItem icon={ShieldCheck} title="Messages about your events" tone="green">
Tickets, receipts, reminders and changes to events you registered for are always sent, by the channel you chose in Profile &amp; Security.
</GuideItem>
<GuideItem icon={MailX} title="Unsubscribe" tone="amber">
Every news email has an unsubscribe link, and you can reply STOP to a news message on WhatsApp. The history under the boxes shows every choice you made and when.
</GuideItem>
</div>
),
},
{
key: "data",
label: "Your data",
icon: Download,
content: (
<div className="space-y-4">
<GuideItem icon={Download} title="Download my data" tone="brand">
The PDF is easy to read; the JSON file is the complete copy. Both include your registrations, the people you registered, form answers, payments, tickets and check-ins.
</GuideItem>
<GuideItem icon={PencilLine} title="Correct my data" tone="green">
Change your name, email and phone in Profile &amp; Security. For anything else, send a correction request — we answer by email within 30 days.
</GuideItem>
<GuideItem icon={Trash2} title="Delete my account" tone="rose">
Your account is closed straight away. Your personal information is deleted once the request is processed (within 30 days) — after any upcoming event you registered for. Payment amounts and dates are kept without your name, because the law requires it.
</GuideItem>
</div>
),
},
],
};
/** Help content for /dashboard/admin/data-requests. */
export const adminDataRequestsHelpContent: HelpContent = {
title: "Data requests",
subtitle: "POPIA requests from people about their personal information.",
tabs: [
{
key: "how",
label: "How it works",
icon: Inbox,
content: (
<div className="space-y-4">
<GuideItem icon={Inbox} title="Where requests come from" tone="brand">
People send correction and deletion requests from their Privacy page (or by ticking &quot;also delete my data&quot; when closing their account). The Information Officer (Site settings → Legal) and all admins are emailed for each one.
</GuideItem>
<GuideItem icon={Clock} title="30 days" tone="amber">
POPIA asks for an answer within 30 days. Requests due within a week or overdue are emailed to admins every morning, and overdue ones are outlined in red.
</GuideItem>
<GuideItem icon={Download} title="Access requests" tone="green">
People download their own data from their Privacy page, so those aren&apos;t listed here. If someone asks by email or phone, point them to that page. (Downloading is blocked while viewing as someone else, so an admin can&apos;t take a person&apos;s full record that way.)
</GuideItem>
</div>
),
},
{
key: "handle",
label: "Handling a request",
icon: Trash2,
content: (
<div className="space-y-4">
<GuideItem icon={PencilLine} title="Corrections" tone="brand">
Make the change (e.g. on the registration or attendee), then click Mark as done and say what you changed — it&apos;s emailed to them.
</GuideItem>
<GuideItem icon={Trash2} title="Deletions" tone="rose">
The account is already closed. If they have a registration for an upcoming event, cancel it (refund if needed) or wait until the event is over. Then Delete personal data: their name, contact details, attendees, form answers and the payer details kept by Yoco/PayFast notifications are removed. Payments, registrations and check-ins stay as &quot;Deleted User&quot; for the books and reports. It can&apos;t be undone and is logged in the audit log.
</GuideItem>
<GuideItem icon={MessageCircle} title="Reject or cancel" tone="amber">
Give a reason; it&apos;s emailed to them. Tick &quot;They withdrew it&quot; if they changed their mind. Rejecting or cancelling a deletion opens their account again.
</GuideItem>
</div>
),
},
],
};
@@ -26,6 +26,7 @@ import { supervisorBundlesHelpContent } from "./supervisor-bundles";
import { supervisorConsentHelpContent } from "./supervisor-consent";
import { supervisorWaitlistHelpContent } from "./supervisor-waitlist";
import { supervisorAttendanceHelpContent } from "./supervisor-attendance";
import { userPrivacyHelpContent, adminDataRequestsHelpContent } from "./privacy";
import { supervisorOfflineScansHelpContent } from "./supervisor-offline-scans";
import { supervisorAllocationsHelpContent, staffMyGroupsHelpContent } from "./supervisor-allocations";
import { supervisorEmailAttendeesHelpContent } from "./supervisor-email-attendees";
@@ -179,6 +180,16 @@ const REGISTRY: HelpRegistryEntry[] = [
matches: pathname => pathname === "/dashboard/supervisor/attendance",
content: supervisorAttendanceHelpContent,
},
{
slug: "user-privacy",
matches: pathname => pathname === "/dashboard/user/privacy",
content: userPrivacyHelpContent,
},
{
slug: "admin-data-requests",
matches: pathname => pathname === "/dashboard/admin/data-requests",
content: adminDataRequestsHelpContent,
},
{
slug: "supervisor-consent",
matches: pathname => pathname === "/dashboard/supervisor/consent",
@@ -1,5 +1,5 @@
import React from "react";
import { Mail, Users, Zap, Send, Clock } from "lucide-react";
import { Mail, Users, Zap, Send, Clock, ShieldCheck } from "lucide-react";
import { GuideItem } from "@/components/shared/GuideItem";
import type { HelpContent } from "./types";
@@ -22,6 +22,9 @@ export const supervisorEmailAttendeesHelpContent: HelpContent = {
<GuideItem icon={Send} title="Preview, send, or schedule" tone="green">
Preview the recipient list before sending, send immediately, or pick a future date and time.
</GuideItem>
<GuideItem icon={ShieldCheck} title="Message type (POPIA)" tone="violet">
An <strong>Event update</strong> is about the event they registered for and goes to everyone selected. <strong>News &amp; announcements</strong> (promoting events) only goes to people who opted in, and gets an unsubscribe link — the preview says how many were skipped. The next-event promo automation is always news.
</GuideItem>
</div>
</div>
),
@@ -37,7 +40,7 @@ export const supervisorEmailAttendeesHelpContent: HelpContent = {
Four canned lifecycle emails per event — a pre-event reminder, a final reminder, a thank-you, and a next-event promo — with send times auto-computed from the event&apos;s dates.
</GuideItem>
<GuideItem icon={Mail} title="Broadcasts" tone="violet">
Send to any selected users or pasted external addresses, independent of a specific event&apos;s attendee list.
Send to any selected users or pasted external addresses, independent of a specific event&apos;s attendee list. Broadcasts are News &amp; announcements unless you choose Event update.
</GuideItem>
<GuideItem icon={Clock} title="Scheduled" tone="gray">
Review, edit, or cancel any email that&apos;s scheduled but not yet sent.
@@ -1,5 +1,5 @@
import React from "react";
import { MessageCircle, Users, Zap, Clock } from "lucide-react";
import { MessageCircle, Users, Zap, Clock, ShieldCheck } from "lucide-react";
import { GuideItem } from "@/components/shared/GuideItem";
import type { HelpContent } from "./types";
@@ -19,6 +19,9 @@ export const supervisorWhatsappAttendeesHelpContent: HelpContent = {
<GuideItem icon={MessageCircle} title="Who's eligible" tone="brand">
Only recipients with a phone number can be messaged; the list is pre-filtered and colour-coded by notification preference (WhatsApp / Both), though you can still select a mismatch with a warning.
</GuideItem>
<GuideItem icon={ShieldCheck} title="Message type (POPIA)" tone="violet">
<strong>Event updates</strong> go to everyone selected. <strong>News &amp; announcements</strong> only go to people who opted in to WhatsApp news, and end with &quot;Reply STOP&quot; and an unsubscribe link. Broadcasts are news unless you choose Event update.
</GuideItem>
</div>
</div>
),