From fe4c61880ef1a8fc7778629a2e113b3416ed372f Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Sun, 24 Nov 2024 12:45:49 +0100 Subject: [PATCH] Fixed new conversation error dialog being wonky --- sbapp/main.py | 4 ++++ sbapp/sideband/core.py | 6 +++++- sbapp/ui/conversations.py | 4 ++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/sbapp/main.py b/sbapp/main.py index 31e4df8..fa8eeb3 100644 --- a/sbapp/main.py +++ b/sbapp/main.py @@ -2627,11 +2627,15 @@ class SidebandApp(MDApp): RNS.log("Error while creating conversation: "+str(e), RNS.LOG_ERROR) if new_result: + dialog.d_content.ids["n_address_field"].helper_text = "" + dialog.d_content.ids["n_address_field"].helper_text_mode = "on_focus" dialog.d_content.ids["n_address_field"].error = False dialog.dismiss() if self.conversations_view != None: self.conversations_view.update() else: + dialog.d_content.ids["n_address_field"].helper_text = "Invalid address, check your input" + dialog.d_content.ids["n_address_field"].helper_text_mode = "persistent" dialog.d_content.ids["n_address_field"].error = True # dialog.d_content.ids["n_error_field"].text = "Could not create conversation. Check your input." diff --git a/sbapp/sideband/core.py b/sbapp/sideband/core.py index c3542b8..137dc8d 100644 --- a/sbapp/sideband/core.py +++ b/sbapp/sideband/core.py @@ -4264,7 +4264,11 @@ class SidebandCore(): try: addr_b = bytes.fromhex(dest_str) - self._db_create_conversation(addr_b, name, trusted) + if addr_b == self.lxmf_destination.hash: + RNS.log("Cannot create conversation with own LXMF address", RNS.LOG_ERROR) + return False + else: + self._db_create_conversation(addr_b, name, trusted) except Exception as e: RNS.log("Error while creating conversation: "+str(e), RNS.LOG_ERROR) diff --git a/sbapp/ui/conversations.py b/sbapp/ui/conversations.py index 9dcc210..d624100 100644 --- a/sbapp/ui/conversations.py +++ b/sbapp/ui/conversations.py @@ -524,8 +524,8 @@ Builder.load_string(""" id: n_address_field max_text_length: 32 hint_text: "Address" - helper_text: "Error, check your input" - helper_text_mode: "on_error" + helper_text: "" + helper_text_mode: "on_focus" text: "" font_size: dp(24)