diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2024-05-09 23:27:41 +0200 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2024-05-09 23:27:41 +0200 |
commit | 2fc46023337dfce4c17dc3d38cbc2a6804ffaf96 (patch) | |
tree | 61ebf5a9ec48c04315c7619fd0b169c38cb98bf2 | |
parent | 3bdf89c18535ee8844fc03665efc1cab22ae61e6 (diff) |
Implement MSC4142, mention via replies
-rw-r--r-- | src/timeline/InputBar.cpp | 10 |
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_, |