summary refs log tree commit diff
path: root/src/timeline
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2022-12-03 02:10:45 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2022-12-05 18:39:47 +0100
commit59703d3c255d8809434824838619b2239abe28fe (patch)
treef864ef15b0ad05b3a4eb2f418a9a02539ae47594 /src/timeline
parentTranslated using Weblate (Chinese (Simplified)) (diff)
downloadnheko-59703d3c255d8809434824838619b2239abe28fe.tar.xz
Implement MSC3664, pushrules for related events
Diffstat (limited to 'src/timeline')
-rw-r--r--src/timeline/TimelineModel.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp

index dedfa197..f61214fd 100644 --- a/src/timeline/TimelineModel.cpp +++ b/src/timeline/TimelineModel.cpp
@@ -742,7 +742,18 @@ TimelineModel::data(const mtx::events::collections::TimelineEvents &event, int r case Notificationlevel: { const auto &push = ChatPage::instance()->pushruleEvaluator(); if (push) { - auto actions = push->evaluate({event}, pushrulesRoomContext()); + const auto &id = event_id(event); + std::vector<std::pair<mtx::common::Relation, mtx::events::collections::TimelineEvent>> + relatedEvents; + for (const auto &r : mtx::accessors::relations(event).relations) { + auto related = events.get(r.event_id, id); + if (related) { + relatedEvents.emplace_back(r, + mtx::events::collections::TimelineEvent{*related}); + } + } + + auto actions = push->evaluate({event}, pushrulesRoomContext(), relatedEvents); if (std::find(actions.begin(), actions.end(), mtx::pushrules::actions::Action{