From c3d90539e9a7addd3c41f44b864b14bde60958dc Mon Sep 17 00:00:00 2001 From: r Date: Sat, 14 Nov 2020 14:08:16 +0000 Subject: Add notification interval setting It replaces the "Auto refresh notifications" checkbox --- service/service.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'service/service.go') diff --git a/service/service.go b/service/service.go index 48aafda..1ba99da 100644 --- a/service/service.go +++ b/service/service.go @@ -434,7 +434,7 @@ func (svc *service) ServeNotificationPage(c *model.Client, maxID string, } commonData := svc.getCommonData(c, "notifications") - commonData.AutoRefresh = c.Session.Settings.AutoRefreshNotifications + commonData.RefreshInterval = c.Session.Settings.NotificationInterval commonData.Target = "main" commonData.Count = unreadCount data := &renderer.NotificationData{ @@ -932,6 +932,11 @@ func (svc *service) UnSubscribe(c *model.Client, id string) (err error) { } func (svc *service) SaveSettings(c *model.Client, s *model.Settings) (err error) { + switch s.NotificationInterval { + case 0, 30, 60, 120, 300, 600: + default: + return errInvalidArgument + } session, err := svc.sessionRepo.Get(c.Session.ID) if err != nil { return -- cgit v1.2.3