feat: optionally return all raw email addresses for user #4
Conversation
|
||
if (self._allRawEmails) { | ||
profile.emails = json.map(function (email) { | ||
var mappedEmail = Object.assign(email, { value: email.email }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you know which email is the primary one? Should we add type to these? See: http://www.passportjs.org/docs/profile/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here's a sample json
object:
[ { primary: true,
verified: true,
visibility: 'private',
value: 'bob.pineapple@gmail.com' },
{ primary: false,
verified: true,
visibility: null,
value: 'pineapple@users.noreply.github.com' },
{ primary: false,
verified: true,
visibility: null,
value: 'bob@pineapple.com' } ]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, is this what the response looks like? [ { "email": "octocat@github.com", "verified": true, "primary": true, "visibility": "public" } ]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, sounds good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, exactly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my map
just transforms these objects to have a value
key, which seems to be a convention across passport addons
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add a test then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added tests!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but it would be great to add a test as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adopted in part from jaredhanson#27