-
Notifications
You must be signed in to change notification settings - Fork 18
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
chore: add UserDescriptor to branches.list #293
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.
Coming together 👍
Thanks for updating test. You'll also want to update docs
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.
Looking good 👍
Make sure you update the docs and typescript interface to reflect these changes
src/endpoints/Branches.js
Outdated
query = querystring.stringify({ | ||
...queryOptions, | ||
userId: descriptor.userId | ||
}); |
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.
I get the intention here and it'll work until you're using types
list({ projectId, userId })
is not currently allowed so userId
can't be present in the condition below. So query
is only shared in the else branch but not for the projects branch
If we want to allow filtering branches for a user in a project you'll also want:
descriptor?: ProjectDescriptor | ProjectMembershipDescriptor | UserDescriptor
where type ProjectMembershipDescriptor = {| projectId: string, userId: string |}
It looks like that type exist but might be mislabeled and mixed with OrganizationProjectDescriptor
which doesn't appear to be used
@amccloud thanks for the thorough review! I went ahead and updated the type definition, docs, as well as the descriptor mismatch. |
Co-authored-by: Tom Moor <tom@abstract.com>
src/endpoints/Branches.js
Outdated
let response = null; | ||
|
||
if (descriptor && descriptor.userId) { | ||
query = querystring.stringify({ |
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.
This is fine and I'm just nit'ing but you could avoid running stringify twice and neaten this up a little by just adding userId
to the queryOptions inside of this block and then run querystring.stringify
afterwards?
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.
Ty 7c445f0
…m:goabstract/abstract-sdk into chore/add-user-descriptor-for-branch-list
While working on Abstract Home's
My Active Branches
, I needed to grab all the branches from a specific user.This PR adds a
UserDescriptor
as an option to thebranches.list
descriptor, so we can passuserId
to the query params and get all branches for that user.