summary refs log tree commit diff
path: root/resources/qml/dialogs/CreateDirect.qml
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2023-01-21 21:02:46 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2023-01-21 21:02:46 +0100
commit47da48f6f22e68ed9a6856504366197ba7447960 (patch)
treeb78742bb5e305d2ca2ea1158ab7e438f88d70f15 /resources/qml/dialogs/CreateDirect.qml
parentWork around multiple destructor calls after consteval construction in full ex... (diff)
downloadnheko-47da48f6f22e68ed9a6856504366197ba7447960.tar.xz
Fix creating DMs from pasting an mxid
Diffstat (limited to '')
-rw-r--r--resources/qml/dialogs/CreateDirect.qml5
1 files changed, 3 insertions, 2 deletions
diff --git a/resources/qml/dialogs/CreateDirect.qml b/resources/qml/dialogs/CreateDirect.qml
index 69eb38d0..6840029e 100644
--- a/resources/qml/dialogs/CreateDirect.qml
+++ b/resources/qml/dialogs/CreateDirect.qml
@@ -77,7 +77,8 @@ ApplicationWindow {
             label: qsTr("User to invite")
             placeholderText: qsTr("@user:server.tld")
             onTextChanged: {
-                if(isValidMxid) {
+                // we can't use "isValidMxid" here, since the property might only be reevaluated after this change handler.
+                if(text.match("@.+?:.{3,}")) {
                     profile = TimelineManager.getGlobalUserProfile(text);
                 } else
                     profile = null;
@@ -106,7 +107,7 @@ ApplicationWindow {
         Button {
             text: "Start Direct Chat"
             DialogButtonBox.buttonRole: DialogButtonBox.AcceptRole
-            enabled: userID.isValidMxid
+            enabled: userID.isValidMxid && profile
         }
         onRejected: createDirectRoot.close();
         onAccepted: {