Merge remote-tracking branch 'origin/master' into presence

This commit is contained in:
Joseph Donofry 2020-06-11 22:27:30 -04:00
commit 7afb164244
No known key found for this signature in database
GPG key ID: E8A1D78EF044B0CB
40 changed files with 17378 additions and 3971 deletions

View file

@ -452,7 +452,7 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QWidget *parent)
this, &ChatPage::updateGroupsInfo, communitiesList_, &CommunitiesList::setCommunities);
connect(this, &ChatPage::leftRoom, this, &ChatPage::removeRoom);
connect(this, &ChatPage::notificationsRetrieved, this, &ChatPage::sendDesktopNotifications);
connect(this, &ChatPage::notificationsRetrieved, this, &ChatPage::sendNotifications);
connect(this,
&ChatPage::highlightedNotifsRetrieved,
this,
@ -527,7 +527,7 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QWidget *parent)
hasNotifications = true;
}
if (hasNotifications && userSettings_->hasDesktopNotifications())
if (hasNotifications && userSettings_->hasNotifications())
http::client()->notifications(
5,
"",
@ -885,7 +885,7 @@ ChatPage::updateRoomNotificationCount(const QString &room_id,
}
void
ChatPage::sendDesktopNotifications(const mtx::responses::Notifications &res)
ChatPage::sendNotifications(const mtx::responses::Notifications &res)
{
for (const auto &item : res.notifications) {
const auto event_id = mtx::accessors::event_id(item.event);
@ -908,16 +908,23 @@ ChatPage::sendDesktopNotifications(const mtx::responses::Notifications &res)
if (isRoomActive(room_id))
continue;
notificationsManager.postNotification(
room_id,
QString::fromStdString(event_id),
QString::fromStdString(cache::singleRoomInfo(item.room_id).name),
cache::displayName(room_id, user_id),
utils::event_body(item.event),
cache::getRoomAvatar(room_id));
if (userSettings_->hasAlertOnNotification()) {
QApplication::alert(this);
}
if (userSettings_->hasDesktopNotifications()) {
notificationsManager.postNotification(
room_id,
QString::fromStdString(event_id),
QString::fromStdString(
cache::singleRoomInfo(item.room_id).name),
cache::displayName(room_id, user_id),
utils::event_body(item.event),
cache::getRoomAvatar(room_id));
}
}
} catch (const lmdb::error &e) {
nhlog::db()->warn("error while sending desktop notification: {}", e.what());
nhlog::db()->warn("error while sending notification: {}", e.what());
}
}
}