notifcenter: show urgent (critical) notifications at the top
This commit is contained in:
parent
f174d35383
commit
03ff5aa3c6
1 changed files with 14 additions and 1 deletions
|
|
@ -90,7 +90,13 @@ QtObject {
|
|||
});
|
||||
|
||||
root._byId[item.id] = item;
|
||||
root.list = [item, ...root.list];
|
||||
root.list = [item, ...root.list].sort((a, b) => {
|
||||
const aU = a.urgency === NotificationUrgency.Critical ? 1 : 0;
|
||||
const bU = b.urgency === NotificationUrgency.Critical ? 1 : 0;
|
||||
if (aU !== bU)
|
||||
return bU - aU;
|
||||
return b.time - a.time;
|
||||
});
|
||||
|
||||
// Trim excess popups
|
||||
const max = M.Modules.notifications.maxPopups || 4;
|
||||
|
|
@ -174,6 +180,13 @@ QtObject {
|
|||
root._byId[item.id] = item;
|
||||
root.list.push(item);
|
||||
}
|
||||
root.list.sort((a, b) => {
|
||||
const aU = a.urgency === NotificationUrgency.Critical ? 1 : 0;
|
||||
const bU = b.urgency === NotificationUrgency.Critical ? 1 : 0;
|
||||
if (aU !== bU)
|
||||
return bU - aU;
|
||||
return b.time - a.time;
|
||||
});
|
||||
root._changed();
|
||||
} catch (e) {}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue