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
|
|
|
|
2020-07-04 10:49:43 +02:00
|
|
|
from zerver.models import UserMessage
|
2017-04-26 00:35:52 +02:00
|
|
|
|
2020-01-14 21:59:46 +01:00
|
|
|
|
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
|
2021-02-12 08:20:45 +01:00
|
|
|
UserMessage.objects.all().update(flags=F("flags").bitand(~UserMessage.flags.read))
|
2017-04-26 00:35:52 +02:00
|
|
|
cache._cache.flush_all()
|