streams: Unset is_realm_public on attachment when unarchiving streams.

We did not unset is_realm_public field on attachements when unarchiving
streams, but we do unset is_web_public field. This commit adds code to
unset the is_realm_public field as well as we make the stream private
while unarchiving it.
This commit is contained in:
Sahil Batra 2023-11-11 22:24:05 +05:30 committed by Tim Abbott
parent 1f3a53db2d
commit 30e2c14f4a
1 changed files with 6 additions and 3 deletions

View File

@ -201,10 +201,13 @@ def do_unarchive_stream(
).only("id")
cache_delete_many(to_dict_cache_key_id(message.id) for message in messages)
# Unset the is_web_public cache on attachments, since the stream is now private.
Attachment.objects.filter(messages__recipient_id=stream.recipient_id).update(is_web_public=None)
# Unset the is_web_public and is_realm_public cache on attachments,
# since the stream is now private.
Attachment.objects.filter(messages__recipient_id=stream.recipient_id).update(
is_web_public=None, is_realm_public=None
)
ArchivedAttachment.objects.filter(messages__recipient_id=stream.recipient_id).update(
is_web_public=None
is_web_public=None, is_realm_public=None
)
RealmAuditLog.objects.create(