-
Notifications
You must be signed in to change notification settings - Fork 73
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
Allow info to be null on getProfileInfo #232
Conversation
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.
Looks good to me, however, I'm concerned that the two string may be too specific.
src/components/intent.ts
Outdated
@@ -520,7 +520,7 @@ export class Intent { | |||
* @return A Promise that resolves with the requested user's profile | |||
* information | |||
*/ | |||
public async getProfileInfo(userId: string, info: string, useCache=true) { | |||
public async getProfileInfo(userId: string, info: "avatar_url"|"displayname"|null = null, useCache = true) { |
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.
Are "avatar_url"|"displayname" the only values that profile.get()
supports?
TypeScript becomes a pain if Types are incorrectly too strict.
But if they are the only reasonable values, great to help bridges using this library to spell them correctly.
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.
The spec doesn't allow arbitrary keys, and it's been that way for as long as Matrix has been around. We can update this if the spec changes at some point.
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. the builds are failing.
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.
We use this in various places on the Slack bridge to get the full profile of a user.