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

is this an OnUserDelete bug in NotificationModule.php? #178

Closed
alirezastack opened this issue Sep 16, 2014 · 2 comments
Closed

is this an OnUserDelete bug in NotificationModule.php? #178

alirezastack opened this issue Sep 16, 2014 · 2 comments

Comments

@alirezastack
Copy link

In the onUserDelete() function in NotificationModule we have two codes as below:

    foreach (Notification::model()->findAllByAttributes(array('user_id' => $event->sender->id)) as $notification) {
        $notification->delete();
    }

    foreach (Notification::model()->findAllByAttributes(array('source_object_model' => 'User', 'user_id' => $event->sender->id)) as $notification) {
        $notification->delete();
    }

When the first loop iterates through Notifs and delete them all. We don't have Notifs with the same user_id for the second loop. It seems that second one is useless!? Correct me if I'm wrong.

Cheers

@alirezastack
Copy link
Author

So the part " 'source_object_model' => 'User' " doesn't do anything as we don't have user.

@luke-
Copy link
Contributor

luke- commented Sep 16, 2014

Yes, thank you! Second attribute should be "source_object_id' => $event->sender->id

@luke- luke- closed this as completed Sep 16, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants