Ask Your Question
1

How to delete all notifications?

asked 2012-12-28 09:36:02 -0600

ripper234 gravatar image

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.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2012-12-29 13:55:12 -0600

Evgeny gravatar image

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.

edit flag offensive delete link more

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 gravatar imageripper234 ( 2012-12-30 05:06:58 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-12-28 09:36:02 -0600

Seen: 125 times

Last updated: Dec 29 '12