From c70ef430578076f0954e4b0f5a199fe9207b4aa4 Mon Sep 17 00:00:00 2001 From: AiraNadih <128119996+AiraNadih@users.noreply.github.com> Date: Wed, 16 Apr 2025 02:22:46 +0800 Subject: [PATCH] fix(consistency): align entry fetch content behavior between API and UI --- internal/api/entry.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/api/entry.go b/internal/api/entry.go index 508bbee4..9757cdf7 100644 --- a/internal/api/entry.go +++ b/internal/api/entry.go @@ -331,7 +331,14 @@ func (h *handler) fetchContent(w http.ResponseWriter, r *http.Request) { return } - json.OK(w, r, map[string]string{"content": entry.Content}) + if err := h.store.UpdateEntryTitleAndContent(entry); err != nil { + json.ServerError(w, r, err) + return + } + + readingTime := locale.NewPrinter(user.Language).Plural("entry.estimated_reading_time", entry.ReadingTime, entry.ReadingTime) + + json.OK(w, r, map[string]string{"content": mediaproxy.RewriteDocumentWithRelativeProxyURL(h.router, entry.Content), "reading_time": readingTime}) } func (h *handler) flushHistory(w http.ResponseWriter, r *http.Request) {