From 6424bf98daf42e32ed49e5563a1f0a564873ad1e Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Fri, 5 Nov 2021 12:53:46 +0100 Subject: [PATCH] admin: improve check to remove version notifications Signed-off-by: Jens Langhammer --- authentik/admin/tasks.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/authentik/admin/tasks.py b/authentik/admin/tasks.py index 1ddf43870..3602a24e4 100644 --- a/authentik/admin/tasks.py +++ b/authentik/admin/tasks.py @@ -27,6 +27,7 @@ VERSION_CACHE_TIMEOUT = 8 * 60 * 60 # 8 hours # Chop of the first ^ because we want to search the entire string URL_FINDER = URLValidator.regex.pattern[1:] PROM_INFO = Info("authentik_version", "Currently running authentik version") +LOCAL_VERSION = parse(__version__) def _set_prom_info(): @@ -48,7 +49,7 @@ def clear_update_notifications(): if "new_version" not in notification.event.context: continue notification_version = notification.event.context["new_version"] - if notification_version == __version__: + if LOCAL_VERSION >= parse(notification_version): notification.delete() @@ -74,8 +75,7 @@ def update_latest_version(self: MonitoredTask): _set_prom_info() # Check if upstream version is newer than what we're running, # and if no event exists yet, create one. - local_version = parse(__version__) - if local_version < parse(upstream_version): + if LOCAL_VERSION < parse(upstream_version): # Event has already been created, don't create duplicate if Event.objects.filter( action=EventAction.UPDATE_AVAILABLE,