feat(activation): wire autoFlagPreExistingSlackAccess into self-serve paths

Replaces the per-file inviteToSlack helpers with a single auto-flag
call. Self-serve activation paths now check for pre-existing workspace
membership (silent on miss) instead of attempting an admin-only invite.

- helcim/subscription.post.js: removed local inviteToSlack; both
  free- and paid-tier activation branches now call the helper, then
  notifyNewMember with the canonical 'manual_invitation_required' arg.
- members/create.post.js: same shape — helper + canonical notify arg.
- invite/accept.post.js (free-tier branch): added the helper call after
  member creation. Free-tier had no prior Slack call (audit confirmed);
  paid-tier remains untouched and activates via the Helcim webhook.

Admin-created and CSV-imported members intentionally do NOT call the
helper — admins flip the flag manually after sending the invite.

Test stub for autoFlagPreExistingSlackAccess added to server setup.
This commit is contained in:
Jennie Robinson Faber 2026-04-29 12:21:12 +01:00
parent b1d8cb1966
commit 55029e7eb7
5 changed files with 262 additions and 152 deletions

View file

@ -87,6 +87,7 @@ export default defineEventHandler(async (event) => {
// For free tier, redirect to welcome
if (body.contributionAmount === 0) {
await autoFlagPreExistingSlackAccess(member)
return {
success: true,
requiresPayment: false,