Add missing return in fetchContent ui handler

This commit is contained in:
Frédéric Guillot 2023-09-06 20:34:36 -07:00
parent 69738bce84
commit 5ce912beea
1 changed files with 3 additions and 4 deletions

View File

@ -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)