aboutsummaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/Matrix.cpp27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index cb9bd69..fce4135 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -1044,7 +1044,6 @@ namespace QuickMedia {
extra_data->read = notification.read;
body_item->extra = std::move(extra_data);
- body->apply_search_filter_for_item(body_item.get());
return body_item;
}
@@ -1063,13 +1062,17 @@ namespace QuickMedia {
PluginResult MatrixNotificationsPage::get_page(const std::string&, int, BodyItems &result_items) {
return matrix->get_previous_notifications([this, &result_items](const MatrixNotification &notification) {
- result_items.push_back(notification_to_body_item(notifications_body, notification));
+ auto body_item = notification_to_body_item(notifications_body, notification);
+ room_notifications[notification.room].push_back(body_item);
+ result_items.push_back(body_item);
});
}
PluginResult MatrixNotificationsPage::lazy_fetch(BodyItems &result_items) {
matrix->get_cached_notifications([this, &result_items](const MatrixNotification &notification) {
- result_items.push_back(notification_to_body_item(notifications_body, notification));
+ auto body_item = notification_to_body_item(notifications_body, notification);
+ room_notifications[notification.room].push_back(body_item);
+ result_items.push_back(body_item);
});
return PluginResult::OK;
}
@@ -1082,20 +1085,26 @@ namespace QuickMedia {
//int prev_selected_item = notifications_body->get_selected_item();
//notifications_body->items.push_back(notification_to_body_item(notifications_body, notification));
//notifications_body->set_selected_item(prev_selected_item - 1);
- notifications_body->prepend_item(notification_to_body_item(notifications_body, notification));
+ auto body_item = notification_to_body_item(notifications_body, notification);
+ room_notifications[notification.room].push_back(body_item);
+ notifications_body->prepend_item(body_item);
notifications_body->select_next_item();
}
// TODO: Only loop unread items
void MatrixNotificationsPage::set_room_as_read(RoomData *room) {
- notifications_body->for_each_item([room](std::shared_ptr<BodyItem> &body_item) {
- NotificationsExtraData *extra_data = static_cast<NotificationsExtraData*>(body_item->extra.get());
+ auto it = room_notifications.find(room);
+ if(it == room_notifications.end())
+ return;
+
+ for(const auto &room_notification : it->second) {
+ NotificationsExtraData *extra_data = static_cast<NotificationsExtraData*>(room_notification->extra.get());
if(!extra_data->read && extra_data->room == room) {
extra_data->read = true;
- body_item->set_author_color(get_current_theme().text_color);
- body_item->set_description_color(get_current_theme().text_color);
+ room_notification->set_author_color(get_current_theme().text_color);
+ room_notification->set_description_color(get_current_theme().text_color);
}
- });
+ }
}
SearchResult MatrixInviteUserPage::search(const std::string &str, BodyItems &result_items) {