summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2024-05-09 23:27:41 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2024-05-09 23:42:36 +0200
commitcf373c016ad422d9a338209a45253455eb38a387 (patch)
treea39ec11e8ed9f22af18fa0679fec76aae99dd269
parentMerge pull request #1720 from TheDrawingCoder-Gamer/emoji-shortcodes-2 (diff)
downloadnheko-cf373c016ad422d9a338209a45253455eb38a387.tar.xz
Implement MSC4142, mention via replies
-rw-r--r--src/timeline/InputBar.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/timeline/InputBar.cpp b/src/timeline/InputBar.cpp
index 1636bcd1..ac1d47a2 100644
--- a/src/timeline/InputBar.cpp
+++ b/src/timeline/InputBar.cpp
@@ -504,6 +504,16 @@ InputBar::generateMentions()
     for (const auto &m : mentions_)
         if (m != u"@room")
             userMentions.push_back(m.toStdString());
+
+    if (!room->reply().isEmpty()) {
+        auto replyToSender =
+          room->dataById(room->reply(), TimelineModel::Roles::UserId, "").toString().toStdString();
+        if (!replyToSender.empty() &&
+            std::ranges::find(userMentions, replyToSender) == userMentions.end()) {
+            userMentions.push_back(replyToSender);
+        }
+    }
+
     auto mention = mtx::common::Mentions{
       .user_ids = userMentions,
       .room     = containsAtRoom_,