If a user is subscribed to a tag and that tag is deleted, a blank subscription remains under the user's "Notifications - Subscriptions" tab, as well as under the "Manage subscriptions" admin page. This is because the subscription is deleted from notifications_fields but not from notifications.
Looking at the code, I don't know why this would be, since all of the deletes occur in a simple foreach loop. Any ideas?
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | notifications-477954-1.patch | 1006 bytes | danepowell |
Comments
Comment #1
danepowell commentedSorry, my analysis was wrong - the subscription isn't deleted at all, because hook_taxonomy is not even implemented :) Here's a patch that takes care of that.
Comment #2
David Goode commentedHey,
Thanks for the catch, doesn't look like they would be deleted. However, this would actually delete anything that happens to have the same int value as the tid--say a subscription to a nid for notifications_content. Anyway, there is a function in notifications that does this for you. Here's the preliminary modified code from your patch--I'd appreciate it if you could test this out and see if it works for you.
Also, we should take care of vocabs, look at other contingencies, and perhaps check out other subscription types to see if they are missing delete hooks before committing a patch. Any help anyone can provide in these areas would be appreciated.
Thanks a lot,
David
Comment #3
jose reyero commented@David, I think your fixed version looks good, commit when you think its ready.
If unsure, you can add more tests :-)
Comment #4
danepowell commented@David, Good catch, I don't know why I didn't think to use that function. I applied your version of the patch on my site and it works great.
I will take a look at handling deleted vocabularies and content types. My philosophy is usually "if you've got a fix, commit it", and you can flesh it out later. But since this isn't a critical issue, a commit can probably wait until we do it right.
Comment #5
David Goode commentedCommitted! Thanks for the help danep.
David
Comment #6
danepowell commentedOn further review it looks like deleted content types are already taken care of in the code. Deleting vocabularies are also taken care of because when a vocabulary is deleted, hook_taxonomy fires for each deleted term.