Add utility script to find a user by email (UserService.findAllByEmail looks in identities)
Fix https://gitlab.com/gitlab-org/gitter/webapp/issues/1843
- Add
UserService.findAllByEmail
(also backsUserService.findByEmail
) which can find a user by their identity emails. - Add utility script
node script/utils/find-users-by-email.js --email foo@bar.com
- Persist emails for GitHub users when they sign in (so we have something to find)
- This was normally sent off to Intercom and could be referenced easily (but we are no longer using Intercom), https://gitlab.com/gitlab-org/gitter/webapp/merge_requests/1096
- Currently it is stored in the
UserSchema.emails
array but we could insert a GitHub identity but not everyone would have a GitHub identity, also see https://gitlab.com/gitlab-org/gitter/webapp/blob/599aa0d3fd638d43eef0f9c0d8758481f592e1f3/server/services/user-service.js#L116 - This is still a bit problematic for existing users that don't sign in and we can't reference them if they make a support ticket. But we can always look at our Intercom data
😉
Todo
In production, add indexes:
db.users.createIndex({
emails: 1
}, {
background: true
})
db.identities.createIndex({
email: 1
}, {
background: true
})
Closes https://gitlab.com/gitlab-org/gitter/webapp/issues/1843
Edited by 🤖 GitLab Bot 🤖