Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

follow shouldNotify flag to hide notifications when needed #5530

Merged
merged 1 commit into from
Mar 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/gui/tray/activitydata.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ class Activity
* @return
*/

bool _shouldNotify = true;

[[nodiscard]] Identifier ident() const;
};
Expand Down
4 changes: 4 additions & 0 deletions src/gui/tray/notificationhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ void ServerNotificationHandler::slotNotificationsReceived(const QJsonDocument &j
}
}

if (json.contains("shouldNotify")) {
a._shouldNotify = json.value("shouldNotify").toBool(true);
}

// 2 cases to consider:
// 1. server == 24 & has Talk: object_type is chat/call/room & object_id contains conversationToken/messageId
// 2. server < 24 & has Talk: object_type is chat/call/room & object_id contains _only_ conversationToken
Expand Down
9 changes: 9 additions & 0 deletions src/gui/tray/usermodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@ void User::slotBuildNotificationDisplay(const ActivityList &list)
qCInfo(lcActivity) << "Activity already notified, skip";
return false;
}
if (!activity._shouldNotify) {
qCDebug(lcActivity) << "Activity should not be notified";
return false;
}

return true;
});
Expand Down Expand Up @@ -226,6 +230,11 @@ void User::slotBuildIncomingCallDialogs(const ActivityList &list)

if(systray) {
for(const auto &activity : list) {
if (!activity._shouldNotify) {
qCDebug(lcActivity) << "Activity should not be notified";
continue;
}

systray->createCallDialog(activity, _account);
}
}
Expand Down