-
Notifications
You must be signed in to change notification settings - Fork 254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
getUserProfile() default fields #166
base: master
Are you sure you want to change the base?
Conversation
…ture/default-fields
What do you say? 🙄 |
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.
Hey @drezo, thanks for the PR and sorry for the big delay. I haven't been paying much attention to this project or the chatbot scene for the last year, I apologize if this makes your job harder.
The PR looks good for the most part, I left a couple of comments for thing that I'd like to see changed. Please let me know what you think.
* @returns {Promise} | ||
*/ | ||
getUserProfile(userId) { | ||
const url = `https://graph.facebook.com/${this.graphApiVersion}/${userId}?fields=first_name,last_name,profile_pic,locale,timezone,gender&access_token=${this.accessToken}`; | ||
getUserProfile(userId, fields) { |
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.
Can we give fields
a default value of []
? Otherwise, the check on line 344 would make the method fail for people who are calling it directly without fields.
|
||
| Param | Type | Default | Required | | ||
|:------|:-----|:--------|:---------| | ||
| `fields` | array | ['id', 'name', 'first_name', 'last_name', 'profile_pic'] | `N` | |
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.
It seems that we should change this description. The default value of the fields
param is not ['id', 'name', ... ]
, it's an empty array. When you specify fields, you're not overwriting this default value, you're extending it. I think we should either change the behavior to allow specifying/overwriting all fields, or change this description and maybe the param name to extraFields
so that it's clear that you're extending the default. What do you think?
Hello! ✌️
Permissions my application ("locale", "timezone", "gender" unavailable):
Next, we downloaded current version package (1.0.16), used method "getUserProfile()" and get the follow error 😑:
Changed method "getUserProfile()":
Thanks!