From 64bc99fc8df75b3f3e49359853b2e3ea3530da5e Mon Sep 17 00:00:00 2001 From: Umputun Date: Tue, 18 Jun 2019 12:38:51 -0500 Subject: [PATCH] fix incorrect default since for last comments stream --- backend/app/rest/api/rest_public.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/backend/app/rest/api/rest_public.go b/backend/app/rest/api/rest_public.go index ab61f920..201b66de 100644 --- a/backend/app/rest/api/rest_public.go +++ b/backend/app/rest/api/rest_public.go @@ -208,8 +208,7 @@ func (s *public) lastCommentsCtrl(w http.ResponseWriter, r *http.Request) { } sinceTime := time.Time{} - since := r.URL.Query().Get("since") - if since != "" { + if since := r.URL.Query().Get("since"); since != "" { unixTS, e := strconv.ParseInt(since, 10, 64) if e != nil { rest.SendErrorJSON(w, r, http.StatusBadRequest, e, "can't translate since parameter", rest.ErrDecode) @@ -244,9 +243,8 @@ func (s *public) lastCommentsStreamCtrl(w http.ResponseWriter, r *http.Request) siteID := r.URL.Query().Get("site") log.Printf("[DEBUG] get last comments stream for %s", siteID) - sinceTs := time.Time{} - since := r.URL.Query().Get("since") - if since != "" { + sinceTs := time.Now() + if since := r.URL.Query().Get("since"); since != "" { unixTS, e := strconv.ParseInt(since, 10, 64) if e != nil { rest.SendErrorJSON(w, r, http.StatusBadRequest, e, "can't translate since parameter", rest.ErrDecode)