From 21a6e1559ae8bde8fa7e5464c96337ccd7b51128 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 2 May 2022 23:50:14 +0100 Subject: [PATCH] Check for multiple emoji display name --- utils.py | 8 +++++++- webapp_post.py | 29 ++--------------------------- 2 files changed, 9 insertions(+), 28 deletions(-) diff --git a/utils.py b/utils.py index d4d9cefd2..9a80fef27 100644 --- a/utils.py +++ b/utils.py @@ -1025,7 +1025,13 @@ def display_name_is_emoji(display_name: str) -> bool: """Returns true if the given display name is an emoji """ if ' ' in display_name: - return False + words = display_name.split(' ') + for wrd in words: + if not wrd.startswith(':'): + return False + if not wrd.endswith(':'): + return False + return True if len(display_name) < 2: return False if not display_name.startswith(':'): diff --git a/webapp_post.py b/webapp_post.py index 70f39b3ab..9175930d4 100644 --- a/webapp_post.py +++ b/webapp_post.py @@ -1143,17 +1143,13 @@ def _get_post_title_announce_html(base_dir: str, container_class_icons, container_class) -def _reply_to_yourself_html(actor: str, display_name: str, - translate: {}) -> str: +def _reply_to_yourself_html(translate: {}) -> str: """Returns html for a title which is a reply to yourself """ replying_to_themselves_str = 'replying to themselves' if translate.get(replying_to_themselves_str): replying_to_themselves_str = translate[replying_to_themselves_str] title_str = \ - ' \n' + \ '