NotificationsManager: Minor refactoring
This commit is contained in:
committed by
Tobias Fella
parent
98a277ac63
commit
593f772845
@@ -270,10 +270,8 @@ void NotificationsManager::postInviteNotification(NeoChatRoom *rawRoom)
|
|||||||
if (NeoChatConfig::rejectUnknownInvites()) {
|
if (NeoChatConfig::rejectUnknownInvites()) {
|
||||||
auto job = room->connection()->callApi<NeochatGetCommonRoomsJob>(roomMemberEvent->senderId());
|
auto job = room->connection()->callApi<NeochatGetCommonRoomsJob>(roomMemberEvent->senderId());
|
||||||
connect(job, &BaseJob::result, this, [this, job, room] {
|
connect(job, &BaseJob::result, this, [this, job, room] {
|
||||||
QJsonObject replyData = job->jsonData();
|
if (QJsonObject replyData = job->jsonData(); replyData.contains(u"joined"_s)) {
|
||||||
if (replyData.contains(u"joined"_s)) {
|
if (!replyData["joined"_L1].toArray().isEmpty()) {
|
||||||
const bool inAnyOfOurRooms = !replyData["joined"_L1].toArray().isEmpty();
|
|
||||||
if (inAnyOfOurRooms) {
|
|
||||||
doPostInviteNotification(room);
|
doPostInviteNotification(room);
|
||||||
} else {
|
} else {
|
||||||
room->forget();
|
room->forget();
|
||||||
@@ -429,9 +427,8 @@ QPixmap NotificationsManager::createNotificationImage(const QImage &icon, NeoCha
|
|||||||
painter.setBrush(brush);
|
painter.setBrush(brush);
|
||||||
painter.drawRoundedRect(imageRect, imageRect.width(), imageRect.height());
|
painter.drawRoundedRect(imageRect, imageRect.width(), imageRect.height());
|
||||||
|
|
||||||
if (room != nullptr) {
|
if (room) {
|
||||||
const auto roomAvatar = room->avatar(imageRect.width(), imageRect.height());
|
if (const auto roomAvatar = room->avatar(imageRect.width(), imageRect.height()); !roomAvatar.isNull() && icon != roomAvatar) {
|
||||||
if (!roomAvatar.isNull() && icon != roomAvatar) {
|
|
||||||
const QRect lowerQuarter{imageRect.center(), imageRect.size() / 2};
|
const QRect lowerQuarter{imageRect.center(), imageRect.size() / 2};
|
||||||
|
|
||||||
painter.setBrush(Qt::white);
|
painter.setBrush(Qt::white);
|
||||||
|
|||||||
Reference in New Issue
Block a user