Explorar o código

Add missing return in fetchContent ui handler

Frédéric Guillot %!s(int64=2) %!d(string=hai) anos
pai
achega
5ce912beea
Modificáronse 1 ficheiros con 3 adicións e 4 borrados
  1. 3 4
      internal/ui/entry_scraper.go

+ 3 - 4
internal/ui/entry_scraper.go

@@ -34,12 +34,10 @@ func (h *handler) fetchContent(w http.ResponseWriter, r *http.Request) {
 		return
 	}
 
-	user, err := h.store.UserByID(entry.UserID)
+	user, err := h.store.UserByID(loggedUserID)
 	if err != nil {
 		json.ServerError(w, r, err)
-	}
-	if user == nil {
-		json.NotFound(w, r)
+		return
 	}
 
 	feedBuilder := storage.NewFeedQueryBuilder(h.store, loggedUserID)
@@ -62,6 +60,7 @@ func (h *handler) fetchContent(w http.ResponseWriter, r *http.Request) {
 
 	if err := h.store.UpdateEntryContent(entry); err != nil {
 		json.ServerError(w, r, err)
+		return
 	}
 
 	readingTime := locale.NewPrinter(user.Language).Plural("entry.estimated_reading_time", entry.ReadingTime, entry.ReadingTime)