-
Notifications
You must be signed in to change notification settings - Fork 235
Return all Event Types if no Event Type filter supplied #126
Conversation
@@ -44,6 +44,7 @@ class User | |||
# '/users/pksunkara/events' GET | |||
# - page or query object, optional - params[0] | |||
# - per_page, optional - params[1] | |||
# - filter Event Types, optional - params[2] |
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.
Why is this here?
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.
Because it's one of the parameters to the events method, as seen below.
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.
If you look at the code, you are not using it below. I would suggest to remove this line and change the below code to
if typeof events is array and events.length > 0
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.
And also change README to give an example of how to not filter event types.
Thanks.
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.
Line 51 checks to see whether the events parameter is an array, and if it isn't then it wraps it in an array. Line 50 sets events to null if no events were provided.
(If someone provides null as the events arguments then it becomes [null] on line 52, so I'll fix that)
Otherwise on line 59 events will either be an array or null, so there's no need to check if it's an array or not.
I will update the README and fix the above bug.
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.
Oops, didnt see that. But yeah, please updated README and remove the above comment.
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.
Done.
lgtm. Please squash all the commits into a single commit. |
Don't wrap events param in array if events is null or undefined Update README for Event Type Filtering
Done. |
Return all Event Types if no Event Type filter supplied
Instead of an empty array.