[gnome-software] Rate limit distro upgrade notifications once per week



commit bc934b89c526839231d30a59dbcf5d030982bee3
Author: Kalev Lember <klember redhat com>
Date:   Thu Feb 15 20:01:23 2018 +0100

    Rate limit distro upgrade notifications once per week

 src/gs-update-monitor.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/src/gs-update-monitor.c b/src/gs-update-monitor.c
index c5428400..0d20e8d7 100644
--- a/src/gs-update-monitor.c
+++ b/src/gs-update-monitor.c
@@ -221,7 +221,7 @@ should_show_upgrade_notification (GsUpdateMonitor *monitor)
 
        now = g_date_time_new_now_local ();
        d = g_date_time_difference (now, then);
-       if (d >= 30 * G_TIME_SPAN_DAY)
+       if (d >= 7 * G_TIME_SPAN_DAY)
                return TRUE;
 
        return FALSE;
@@ -271,6 +271,7 @@ get_upgrades_finished_cb (GObject *object,
        GsUpdateMonitor *monitor = GS_UPDATE_MONITOR (data);
        GsApp *app;
        g_autofree gchar *body = NULL;
+       g_autoptr(GDateTime) now = NULL;
        g_autoptr(GError) error = NULL;
        g_autoptr(GNotification) n = NULL;
        g_autoptr(GsAppList) apps = NULL;
@@ -301,6 +302,11 @@ get_upgrades_finished_cb (GObject *object,
        if (!should_show_upgrade_notification (monitor))
                return;
 
+       g_debug ("showing distro upgrade notification");
+       now = g_date_time_new_now_local ();
+       g_settings_set (monitor->settings, "upgrade-notification-timestamp", "x",
+                       g_date_time_to_unix (now));
+
        /* just get the first result : FIXME, do we sort these by date? */
        app = gs_app_list_index (apps, 0);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]