notification: fixed warning introduced by previous "close on LMB"

This commit is contained in:
Lemmy
2026-02-10 10:23:05 -05:00
parent ad6c098139
commit 3328beec86
2 changed files with 21 additions and 14 deletions
+14 -14
View File
@@ -303,20 +303,20 @@ Variants {
hoverEnabled: true
onEntered: card.hoverCount++
onExited: card.hoverCount--
onClicked: {
if (mouse.button === Qt.RightButton) {
animateOut();
} else if (mouse.button === Qt.LeftButton) {
var actions = model.actionsJson ? JSON.parse(model.actionsJson) : [];
var hasDefault = actions.some(function (a) {
return a.identifier === "default";
});
if (hasDefault) {
NotificationService.invokeAction(notificationId, "default");
animateOut();
}
}
}
onClicked: mouse => {
if (mouse.button === Qt.RightButton) {
card.animateOut();
} else if (mouse.button === Qt.LeftButton) {
var actions = model.actionsJson ? JSON.parse(model.actionsJson) : [];
var hasDefault = actions.some(function (a) {
return a.identifier === "default";
});
if (hasDefault) {
NotificationService.invokeAction(notificationId, "default");
card.animateOut();
}
}
}
}
// Animation setup
function triggerEntryAnimation() {
+7
View File
@@ -809,6 +809,13 @@ Singleton {
} else if (!notifData.notification) {
// No notification object
} else {
// Disconnect closed signal before invoking so the app-triggered close
// doesn't immediately remove the delegate (the dismiss animation handles removal)
if (notifData.onClosed) {
notifData.notification.closed.disconnect(notifData.onClosed);
notifData.onClosed = null;
}
// Use cached actions if live actions are empty (which happens if app closed notification)
const actionsToUse = (notifData.notification.actions && notifData.notification.actions.length > 0) ? notifData.notification.actions : (notifData.cachedActions || []);