From c488479f6bddd0438ddecd0facd089b46cbe055a Mon Sep 17 00:00:00 2001 From: Johannes Raggam Date: Mon, 30 Oct 2023 11:28:24 +0100 Subject: [PATCH] Notifications: Sort the notifications in the preferences panel after translated title. --- src/euphorie/client/browser/settings.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/euphorie/client/browser/settings.py b/src/euphorie/client/browser/settings.py index d2778cc4d..d87cae0e2 100644 --- a/src/euphorie/client/browser/settings.py +++ b/src/euphorie/client/browser/settings.py @@ -155,10 +155,16 @@ def getContent(self): @property def all_notifications(self): notifications = getAdapters((self.context, self.request), INotificationCategory) - for notification in notifications: - if not notification[1].available: - continue - yield notification[1] + # Return the available notifications, sorted by title. + notifications = [ + notification[1] + for notification in notifications + if notification[1].available + ] + return sorted( + notifications, + key=lambda notification: translate(notification.title), + ) @property @memoize