Actually fill in user emails from Slack#451
Closed
HazAT wants to merge 1 commit into
Closed
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ba18f8e. Configure here.
| 'status' => User::STATUS_ACTIVE, | ||
| 'slack_user_id' => $slackUser['id'], | ||
| 'slack_name' => $slackUser['real_name'], | ||
| 'slack_email' => $slackUser['profile']['email'] ?? null, |
There was a problem hiding this comment.
Nightly sync clears stored emails
Medium Severity
Each active-user sync always patches slack_email from profile.email, using ?? null when Slack omits that field. Without users:read.email (or when the field is absent), every nightly run writes null and can erase emails that were already backfilled or set at creation.
Reviewed by Cursor Bugbot for commit ba18f8e. Configure here.
Populate the slack_email column from Slack's users.info response in both places users are synced: - UserService::getOrCreateUser() for newly created users - UpdateUsersCommand (nightly cron) for existing users, which also serves as the backfill once the users:read.email OAuth scope is granted — no separate backfill command needed Email falls back to null when Slack doesn't return one (bot users, or missing users:read.email scope), matching the nullable column. Note: requires adding the users:read.email scope to the Slack app for profile.email to be included in users.info responses.
Member
Author
|
Folded into #452 — one PR for the whole email story. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Slack knows everyone's email — we just never asked. Now we grab it when users are created and during the nightly sync, which doubles as the backfill for everyone who's already here. (2/3)
users:read.emailscope added to the Slack app, otherwise Slack keeps it to itself. 🥔