mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	These were useful as a transitional workaround to ignore type errors that only show up with django-stubs, while avoiding errors about unused type: ignore comments without django-stubs. Now that the django-stubs transition is complete, switch to type: ignore comments so that mypy will tell us if they become unnecessary. Many already have. Signed-off-by: Anders Kaseorg <anders@zulip.com>
		
			
				
	
	
		
			21 lines
		
	
	
		
			660 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
		
			660 B
		
	
	
	
		
			Python
		
	
	
	
	
	
from typing import Any
 | 
						|
 | 
						|
import bmemcached
 | 
						|
from django.conf import settings
 | 
						|
from django.core.cache import cache
 | 
						|
from django.core.management.base import BaseCommand
 | 
						|
from django.db.models import F
 | 
						|
 | 
						|
from zerver.models import UserMessage
 | 
						|
 | 
						|
 | 
						|
class Command(BaseCommand):
 | 
						|
    help = """Script to mark all messages as unread."""
 | 
						|
 | 
						|
    def handle(self, *args: Any, **options: Any) -> None:
 | 
						|
        assert settings.DEVELOPMENT
 | 
						|
        UserMessage.objects.all().update(flags=F("flags").bitand(~UserMessage.flags.read))
 | 
						|
        _cache = cache._cache  # type: ignore[attr-defined] # not in stubs
 | 
						|
        assert isinstance(_cache, bmemcached.Client)
 | 
						|
        _cache.flush_all()
 |