summary refs log tree commit diff
path: root/resources/qml/MessageInput.qml
diff options
context:
space:
mode:
Diffstat (limited to 'resources/qml/MessageInput.qml')
-rw-r--r--resources/qml/MessageInput.qml11
1 files changed, 11 insertions, 0 deletions
diff --git a/resources/qml/MessageInput.qml b/resources/qml/MessageInput.qml
index 4396f1d3..8b6af57a 100644
--- a/resources/qml/MessageInput.qml
+++ b/resources/qml/MessageInput.qml
@@ -114,6 +114,10 @@ Rectangle {
                 function insertCompletion(completion) {
                     messageInput.remove(completerTriggeredAt, cursorPosition);
                     messageInput.insert(cursorPosition, completion);
+                    let userid = completer.currentUserid();
+                    if (userid) {
+                        room.input.addMention(userid, completion);
+                    }
                 }
                 function openCompleter(pos, type) {
                     if (popup.opened)
@@ -176,10 +180,17 @@ Rectangle {
                     } else if (event.matches(StandardKey.InsertParagraphSeparator)) {
                         if (popup.opened) {
                             var currentCompletion = completer.currentCompletion();
+                            let userid = completer.currentUserid();
+
                             completer.completerName = "";
                             popup.close();
+
                             if (currentCompletion) {
                                 messageInput.insertCompletion(currentCompletion);
+                                if (userid) {
+                                    console.log(userid);
+                                    room.input.addMention(userid, currentCompletion);
+                                }
                                 event.accepted = true;
                                 return;
                             }