mirror of https://github.com/zulip/zulip.git
archive: Fix typing for prev_sender variable.
We know that via the `AbstractMessage` class that `sender` is of the type `UserProfile`. We type this as `Optional` to tell mypy that the operands to the right of the first `or` can indeed be evaluated within the following `for` loop.
This commit is contained in:
parent
99bd55917e
commit
f22b2c7e9d
|
@ -1,11 +1,11 @@
|
||||||
from typing import List
|
from typing import List, Optional
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.template import loader
|
from django.template import loader
|
||||||
from zerver.lib.streams import get_stream_by_id
|
from zerver.lib.streams import get_stream_by_id
|
||||||
|
|
||||||
from zerver.models import Message, get_stream_recipient
|
from zerver.models import Message, get_stream_recipient, UserProfile
|
||||||
from zerver.lib.avatar import get_gravatar_url
|
from zerver.lib.avatar import get_gravatar_url
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.lib.timestamp import datetime_to_timestamp
|
from zerver.lib.timestamp import datetime_to_timestamp
|
||||||
|
@ -52,7 +52,7 @@ def archive(request: HttpRequest,
|
||||||
return get_response([], True, stream.name)
|
return get_response([], True, stream.name)
|
||||||
|
|
||||||
rendered_message_list = []
|
rendered_message_list = []
|
||||||
prev_sender = None
|
prev_sender = None # type: Optional[UserProfile]
|
||||||
for msg in all_messages:
|
for msg in all_messages:
|
||||||
include_sender = False
|
include_sender = False
|
||||||
status_message = Message.is_status_message(msg.content, msg.rendered_content)
|
status_message = Message.is_status_message(msg.content, msg.rendered_content)
|
||||||
|
|
Loading…
Reference in New Issue