actions: Remove redundant 'url_embed_preview_enabled' check.

We add URLs to the `links_for_embed set`, only when
the `url_embed_preview_enabled` flag is turned on.
So, it is sufficient to check if `links_for_embed`
is not empty.
This commit is contained in:
Hashir Sarwar 2020-04-26 16:30:57 +05:00 committed by Tim Abbott
parent e8c57f2466
commit 3a110bd647
2 changed files with 2 additions and 3 deletions

View File

@ -16,7 +16,6 @@ from analytics.lib.counts import COUNT_STATS, do_increment_logging_stat, \
from zerver.lib.bugdown import ( from zerver.lib.bugdown import (
version as bugdown_version, version as bugdown_version,
url_embed_preview_enabled,
) )
from zerver.lib.addressee import Addressee from zerver.lib.addressee import Addressee
from zerver.lib.bot_config import ( from zerver.lib.bot_config import (
@ -1499,7 +1498,7 @@ def do_send_messages(messages_maybe_none: Sequence[Optional[MutableMapping[str,
event['sender_queue_id'] = message['sender_queue_id'] event['sender_queue_id'] = message['sender_queue_id']
send_event(message['realm'], event, users) send_event(message['realm'], event, users)
if url_embed_preview_enabled(message['message']) and links_for_embed: if links_for_embed:
event_data = { event_data = {
'message_id': message['message'].id, 'message_id': message['message'].id,
'message_content': message['message'].content, 'message_content': message['message'].content,

View File

@ -1608,7 +1608,7 @@ def update_message_backend(request: HttpRequest, user_profile: UserMessage,
# Include the number of messages changed in the logs # Include the number of messages changed in the logs
request._log_data['extra'] = "[%s]" % (number_changed,) request._log_data['extra'] = "[%s]" % (number_changed,)
if links_for_embed and bugdown.url_embed_preview_enabled(message): if links_for_embed:
event_data = { event_data = {
'message_id': message.id, 'message_id': message.id,
'message_content': message.content, 'message_content': message.content,