typing: Add none-checks for stream.recipient_id.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
This commit is contained in:
Zixuan James Li
2022-06-14 22:59:36 -04:00
committed by Tim Abbott
parent 944e602788
commit 058dab5818
7 changed files with 9 additions and 0 deletions

View File

@@ -789,6 +789,7 @@ def do_change_stream_permission(
if old_invite_only_value != stream.invite_only:
# Reset the Attachment.is_realm_public cache for all
# messages in the stream whose permissions were changed.
assert stream.recipient_id is not None
Attachment.objects.filter(messages__recipient_id=stream.recipient_id).update(
is_realm_public=None
)
@@ -832,6 +833,7 @@ def do_change_stream_permission(
if old_is_web_public_value != stream.is_web_public:
# Reset the Attachment.is_realm_public cache for all
# messages in the stream whose permissions were changed.
assert stream.recipient_id is not None
Attachment.objects.filter(messages__recipient_id=stream.recipient_id).update(
is_web_public=None
)