这是indexloc提供的服务,不要输入任何密码
Skip to content
This repository was archived by the owner on Aug 23, 2024. It is now read-only.

Return all Event Types if no Event Type filter supplied #126

Merged
merged 1 commit into from
Jul 30, 2014

Conversation

arrayjam
Copy link
Contributor

Instead of an empty array.

@@ -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]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this here?

Copy link
Contributor Author

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.

Copy link
Owner

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

Copy link
Owner

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.

Copy link
Contributor Author

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.

Copy link
Owner

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@pksunkara
Copy link
Owner

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
@arrayjam
Copy link
Contributor Author

Done.

pksunkara added a commit that referenced this pull request Jul 30, 2014
Return all Event Types if no Event Type filter supplied
@pksunkara pksunkara merged commit a35b426 into pksunkara:master Jul 30, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants