First time here? Check out the FAQ!
1

How to delete all notifications?
 

After migration from Stack Exchange 1, I now have 4588 unread notifications (minor bug in the migration process I guess).

How can I delete them or mark them as read?

When I do it through the normal site interface, all the notifications that are currently seen (~ 20-30) are deleted.

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
ripper234's avatar
99
ripper234
asked 12 years ago

Comments

see more comments

1 Answer

1

Try this in the django shell (stared by python manage.py shell):

from askbot.models import Activity
from askbot import const

activity_types = (
    const.RESPONSE_ACTIVITY_TYPES_FOR_DISPLAY,
    const.TYPE_ACTIVITY_MENTION,
    const.TYPE_ACTIVITY_MARK_OFFENSIVE,
)
Activity.objects.filter(activity_type__in=activity_types).delete()

If there is something else left, we may have to add more activity types to the lookup list.

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
Evgeny's avatar
13.2k
Evgeny
answered 12 years ago
link

Comments

This cleaned up all my notifications, but not the count - I still see a red envelope and get a message "you have 4486 new responses". Could you update the snippet to reset this number? (preferably, just reset it to the actual number of responses and not just to zero).

ripper234's avatar ripper234 (12 years ago)
see more comments