feat(slack): autoFlagPreExistingSlackAccess helper

Best-effort lookup of an activating member's email in the Slack
workspace. On a hit, flips slackInvited:true and stamps slackInvitedAt
without sending a fresh invite. Races against a 3s timeout and swallows
all errors so activation never blocks on Slack.

- Promotes SlackService.findUserByEmail from private to public so the
  helper can call it without a wrapper.
- New activity-log action: slack_access_auto_detected (actor = subject).
- Idempotent: short-circuits when slackInvited is already true.

Callers wired in next commit.
This commit is contained in:
Jennie Robinson Faber 2026-04-29 12:13:59 +01:00
parent 2f6a92ac61
commit b1d8cb1966
4 changed files with 263 additions and 1 deletions

View file

@ -104,7 +104,7 @@ export class SlackService {
/**
* Find user in workspace by email
*/
private async findUserByEmail(email: string): Promise<string | null> {
async findUserByEmail(email: string): Promise<string | null> {
try {
const response = await this.client.users.lookupByEmail({ email });
return response.user?.id || null;