Move notification parsing into postNotification
This commit is contained in:
parent
9f9c499cb2
commit
567b2d05ef
5 changed files with 59 additions and 62 deletions
|
|
@ -668,8 +668,6 @@ ChatPage::sendNotifications(const mtx::responses::Notifications &res)
|
|||
|
||||
if (!cache::isNotificationSent(event_id)) {
|
||||
const auto room_id = QString::fromStdString(item.room_id);
|
||||
const auto user_id =
|
||||
QString::fromStdString(mtx::accessors::sender(item.event));
|
||||
|
||||
// We should only sent one notification per event.
|
||||
cache::markSentNotification(event_id);
|
||||
|
|
@ -689,22 +687,9 @@ ChatPage::sendNotifications(const mtx::responses::Notifications &res)
|
|||
QString::fromStdString(info.avatar_url),
|
||||
96,
|
||||
this,
|
||||
[this, room_id, event_id, item, user_id, info](
|
||||
QPixmap image) {
|
||||
bool isEmote = false;
|
||||
auto ev = cache::client()->getEvent(
|
||||
room_id.toStdString(), event_id);
|
||||
if (ev && mtx::accessors::msg_type(ev->data) ==
|
||||
mtx::events::MessageType::Emote)
|
||||
isEmote = true;
|
||||
[this, item](QPixmap image) {
|
||||
notificationsManager.postNotification(
|
||||
room_id,
|
||||
QString::fromStdString(event_id),
|
||||
QString::fromStdString(info.name),
|
||||
cache::displayName(room_id, user_id),
|
||||
utils::event_body(item.event),
|
||||
image.toImage(),
|
||||
isEmote);
|
||||
item, image.toImage());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue