parent
231bebba44
commit
40ac55ddd9
5 changed files with 40 additions and 0 deletions
|
|
@ -526,6 +526,7 @@ TimelineModel::roleNames() const
|
|||
{IsEncrypted, "isEncrypted"},
|
||||
{IsStateEvent, "isStateEvent"},
|
||||
{Trustlevel, "trustlevel"},
|
||||
{Notificationlevel, "notificationlevel"},
|
||||
{EncryptionError, "encryptionError"},
|
||||
{ReplyTo, "replyTo"},
|
||||
{ThreadId, "threadId"},
|
||||
|
|
@ -737,6 +738,26 @@ TimelineModel::data(const mtx::events::collections::TimelineEvents &event, int r
|
|||
return crypto::Trust::Unverified;
|
||||
}
|
||||
|
||||
case Notificationlevel: {
|
||||
const auto &push = ChatPage::instance()->pushruleEvaluator();
|
||||
if (push) {
|
||||
auto actions = push->evaluate({event}, pushrulesRoomContext());
|
||||
if (std::find(actions.begin(),
|
||||
actions.end(),
|
||||
mtx::pushrules::actions::Action{
|
||||
mtx::pushrules::actions::set_tweak_highlight{}}) != actions.end()) {
|
||||
return qml_mtx_events::NotificationLevel::Highlight;
|
||||
}
|
||||
if (std::find(actions.begin(),
|
||||
actions.end(),
|
||||
mtx::pushrules::actions::Action{mtx::pushrules::actions::notify{}}) !=
|
||||
actions.end()) {
|
||||
return qml_mtx_events::NotificationLevel::Notify;
|
||||
}
|
||||
}
|
||||
return qml_mtx_events::NotificationLevel::Nothing;
|
||||
}
|
||||
|
||||
case EncryptionError:
|
||||
return events.decryptionError(event_id(event));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue