Skip to content
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 setting the ID of the notification manually #8

Merged
merged 4 commits into from
Sep 25, 2016

Conversation

ckald
Copy link
Contributor

@ckald ckald commented Sep 23, 2016

This PR allows to set manually the identifier of the notification. The uniqueness of the ID in this case is the responsibility of the user. This does not change any existing behaviour.

Made for this issue: #6

I am not sure on where to add the documentation about this feature, please point me

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.5%) to 98.37% when pulling cfa9c8d on ckald:dev into 839baff on LouisBarranqueiro:master.

Copy link
Owner

@LouisBarranqueiro LouisBarranqueiro left a comment

Choose a reason for hiding this comment

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

Fix this and it's will be perfect :)

@@ -17,7 +17,9 @@ const REMOVE_NOTIFICATION = 'REMOVE_NOTIFICATION';
* @returns {Object} notification
*/
export const addNotification = (notification) => (dispatch) => {
notification.id = new Date().getTime();
if (notification.id === undefined) {
Copy link
Owner

@LouisBarranqueiro LouisBarranqueiro Sep 24, 2016

Choose a reason for hiding this comment

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

use if (!notification.id) { here, it will prevent empty string, null case, etc...
As you can see, L21 is no more covered because we set notification.id to null in the test case : https://coveralls.io/builds/8020458/source?filename=src%2Fstore%2Fnotifications.js#L21

@coveralls
Copy link

Coverage Status

Coverage increased (+0.006%) to 98.913% when pulling 7fe4da3 on ckald:dev into 839baff on LouisBarranqueiro:master.

Copy link
Owner

@LouisBarranqueiro LouisBarranqueiro left a comment

Choose a reason for hiding this comment

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

Great. Could you also update section of the API documentation please?

@coveralls
Copy link

Coverage Status

Coverage increased (+0.006%) to 98.913% when pulling b5a4345 on ckald:dev into 839baff on LouisBarranqueiro:master.

Copy link
Owner

@LouisBarranqueiro LouisBarranqueiro left a comment

Choose a reason for hiding this comment

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

Could you please, use Number or String instead of Object for the type of the notification ID . Of course in JS, Number and String are object but it's clearer. When we talk about object, we expect : {}.

@@ -113,12 +114,13 @@ updateNotification(notification);

| Parameter | Type | Description |
| ------------ | -------- | ----------- |
| notification | Object | A [notification](https://github.com/LouisBarranqueiro/reapop/blob/master/docs/api.md#notification-object-properties-1) object |
| notification | Object | A [notification](https://github.com/LouisBarranqueiro/reapop/blob/master/docs/api.md#notification-object-properties-1) object or ID of the notification |

Choose a reason for hiding this comment

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

why? If you pass a notification ID, nothing gonna change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, my bad

@coveralls
Copy link

Coverage Status

Coverage increased (+0.006%) to 98.913% when pulling 4a6b9ad on ckald:dev into 839baff on LouisBarranqueiro:master.

Copy link
Owner

@LouisBarranqueiro LouisBarranqueiro left a comment

Choose a reason for hiding this comment

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

Thanks man, for your contribution :)

@LouisBarranqueiro LouisBarranqueiro added this to the 0.5.0 milestone Sep 25, 2016
@LouisBarranqueiro LouisBarranqueiro merged commit 960d193 into LouisBarranqueiro:master Sep 25, 2016
@ckald ckald deleted the dev branch September 25, 2016 20:46
@ckald
Copy link
Contributor Author

ckald commented Sep 25, 2016

Great, thanks for merging. When should I expect to see this on NPM?

@LouisBarranqueiro
Copy link
Owner

Just published :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants