django-wiki / django-nyt

Notification system for Django with batteries included: Email digests, user settings, JSON API
Apache License 2.0
144 stars 47 forks source link

A bug in filtering subscriptions in `Notification.create_notifications` #22

Closed msarabi95 closed 8 years ago

msarabi95 commented 8 years ago

On line 242 in models.py: https://github.com/benjaoming/django-nyt/blob/master/django_nyt/models.py#L242

When creating notifications of a specific NotificationType, subscriptions to that NotificationType with an empty object_id will not receive any notifications.

The reasons seems to be that the above-mentioned line is filtering these subscriptions out. Subscription.object_id is a CharField, and thus will have a value of "" (not None) when empty.

Changing the above line to Q(object_id="") resolves the issue.

msarabi95 commented 8 years ago

OK I just retried that. It turns out to be working properly.

Sorry :)

benjaoming commented 8 years ago

Np, thanks for making a nice description of the issue anyways :)