Init new notification implementation.
This commit is contained in:
parent
6eb7f21090
commit
31203235f2
|
@ -76,17 +76,17 @@ void RoomListModel::connectRoomSignals(SpectralRoom* room) {
|
||||||
connect(room, &Room::joinStateChanged, this, [=] { refresh(room); });
|
connect(room, &Room::joinStateChanged, this, [=] { refresh(room); });
|
||||||
connect(room, &Room::addedMessages, this,
|
connect(room, &Room::addedMessages, this,
|
||||||
[=] { refresh(room, {LastEventRole}); });
|
[=] { refresh(room, {LastEventRole}); });
|
||||||
connect(room, &Room::aboutToAddNewMessages, this,
|
connect(room, &Room::notificationCountChanged, this, [=] {
|
||||||
[=](QMatrixClient::RoomEventsRange eventsRange) {
|
if (room->timelineSize() == 0) return;
|
||||||
RoomEvent* event = (eventsRange.end() - 1)->get();
|
const RoomEvent* lastEvent = room->messageEvents().rbegin()->get();
|
||||||
if (event->isStateEvent()) return;
|
if (lastEvent->isStateEvent()) return;
|
||||||
User* sender = room->user(event->senderId());
|
User* sender = room->user(lastEvent->senderId());
|
||||||
if (sender == room->localUser()) return;
|
if (sender == room->localUser()) return;
|
||||||
emit newMessage(
|
emit newMessage(
|
||||||
room->id(), event->id(), room->displayName(),
|
room->id(), lastEvent->id(), room->displayName(),
|
||||||
sender->displayname(), utils::eventToString(*event),
|
sender->displayname(), utils::eventToString(*lastEvent),
|
||||||
room->avatar(128));
|
room->avatar(128));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void RoomListModel::updateRoom(Room* room, Room* prev) {
|
void RoomListModel::updateRoom(Room* room, Room* prev) {
|
||||||
|
|
Loading…
Reference in New Issue