From cf373c016ad422d9a338209a45253455eb38a387 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Thu, 9 May 2024 23:27:41 +0200 Subject: [PATCH] Implement MSC4142, mention via replies --- src/timeline/InputBar.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/timeline/InputBar.cpp b/src/timeline/InputBar.cpp index 1636bcd1e..ac1d47a22 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_,