2017-04-26 00:35:52 +02:00
|
|
|
|
|
|
|
from typing import Any
|
|
|
|
|
|
|
|
from django.conf import settings
|
2017-11-16 00:55:49 +01:00
|
|
|
from django.core.cache import cache
|
2017-04-26 00:35:52 +02:00
|
|
|
from django.core.management.base import BaseCommand
|
|
|
|
from django.db.models import F
|
2017-11-16 00:55:49 +01:00
|
|
|
|
|
|
|
from zerver.models import UserMessage, UserProfile
|
2017-04-26 00:35:52 +02:00
|
|
|
|
|
|
|
class Command(BaseCommand):
|
|
|
|
help = """Script to mark all messages as unread."""
|
|
|
|
|
2017-10-27 12:57:54 +02:00
|
|
|
def handle(self, *args: Any, **options: Any) -> None:
|
2017-04-26 00:35:52 +02:00
|
|
|
assert settings.DEVELOPMENT
|
|
|
|
UserMessage.objects.all().update(flags=F('flags').bitand(~UserMessage.flags.read))
|
|
|
|
UserProfile.objects.all().update(pointer=0)
|
|
|
|
cache._cache.flush_all()
|