Merge remote-tracking branch 'origin/perSpaceNotifs' into perSpaceNotifs

This commit is contained in:
Nicolas Werner 2022-07-14 01:26:48 +02:00
commit aa63e50cea
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
12 changed files with 374 additions and 124 deletions

View file

@ -364,16 +364,26 @@ TimelineModel::TimelineModel(TimelineViewManager *manager, QString room_id, QObj
{
this->isEncrypted_ = cache::isRoomEncrypted(room_id_.toStdString());
auto roomInfo = cache::singleRoomInfo(room_id_.toStdString());
this->isSpace_ = roomInfo.is_space;
this->notification_count = roomInfo.notification_count;
this->highlight_count = roomInfo.highlight_count;
lastMessage_.timestamp = roomInfo.approximate_last_modification_ts;
auto roomInfo = cache::singleRoomInfo(room_id_.toStdString());
this->isSpace_ = roomInfo.is_space;
this->notification_count =
isSpace_ ? utils::getChildNotificationsForSpace(room_id_).first : roomInfo.notification_count;
this->highlight_count =
isSpace_ ? utils::getChildNotificationsForSpace(room_id_).second : roomInfo.highlight_count;
lastMessage_.timestamp = roomInfo.approximate_last_modification_ts;
// this connection will simplify adding the plainRoomNameChanged() signal everywhere that it
// needs to be
connect(this, &TimelineModel::roomNameChanged, this, &TimelineModel::plainRoomNameChanged);
if (isSpace_)
connect(ChatPage::instance(), &ChatPage::unreadMessages, this, [this](int) {
auto temp{utils::getChildNotificationsForSpace(room_id_)};
notification_count = temp.first;
highlight_count = temp.second;
emit notificationsChanged();
});
connect(
this,
&TimelineModel::redactionFailed,