realm_inline_image_preview: Use it to toggle video previews too.

This setting now also works to decide whether to show previews of
uploaded or linked videos.
This commit is contained in:
Aman Agrawal 2023-11-18 16:17:09 +00:00 committed by Tim Abbott
parent 08b5bcbdb1
commit 71ea6e8863
3 changed files with 7 additions and 2 deletions

View File

@ -15,7 +15,7 @@ prevent images from being used to track Zulip users.
{settings_tab|organization-settings}
1. Under **Other settings**, toggle **Show previews of uploaded and linked images**.
1. Under **Other settings**, toggle **Show previews of uploaded and linked images and videos**.
1. Under **Other settings**, toggle **Show previews of linked websites**.

View File

@ -30,7 +30,9 @@ const admin_settings_label = {
realm_mandatory_topics: $t({defaultMessage: "Require topics in stream messages"}),
realm_notifications_stream: $t({defaultMessage: "New stream announcements"}),
realm_signup_notifications_stream: $t({defaultMessage: "New user announcements"}),
realm_inline_image_preview: $t({defaultMessage: "Show previews of uploaded and linked images"}),
realm_inline_image_preview: $t({
defaultMessage: "Show previews of uploaded and linked images and videos",
}),
realm_inline_url_embed_preview: $t({defaultMessage: "Show previews of linked websites"}),
realm_send_welcome_emails: $t({defaultMessage: "Send emails introducing Zulip to new users"}),
realm_message_content_allowed_in_email_notifications: $t({

View File

@ -1195,6 +1195,9 @@ class InlineInterestingLinkProcessor(markdown.treeprocessors.Treeprocessor):
return insertion_index
def is_video(self, url: str) -> bool:
if not self.zmd.image_preview_enabled:
return False
url_type = mimetypes.guess_type(url)[0]
# Support only video formats (containers) that are supported cross-browser and cross-device. As per
# https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Containers#index_of_media_container_formats_file_types