aboutsummaryrefslogtreecommitdiff
path: root/api/entry.go
diff options
context:
space:
mode:
authorGravatar Frédéric Guillot <f@miniflux.net> 2023-07-30 15:33:56 -0700
committerGravatar Frédéric Guillot <f@miniflux.net> 2023-07-30 15:52:49 -0700
commite7ccf0aa1e4fc7b118042a2d31ee61583ac796a8 (patch)
treee75f9646f7f18aabefb4b68a070fb13d316623d6 /api/entry.go
parente2fb77bd85cf8db966c9b064ae37725d8d0664df (diff)
downloadv2-e7ccf0aa1e4fc7b118042a2d31ee61583ac796a8.tar.gz
v2-e7ccf0aa1e4fc7b118042a2d31ee61583ac796a8.tar.zst
v2-e7ccf0aa1e4fc7b118042a2d31ee61583ac796a8.zip
Add SaveEntry function to API client
Diffstat (limited to 'api/entry.go')
-rw-r--r--api/entry.go15
1 files changed, 7 insertions, 8 deletions
diff --git a/api/entry.go b/api/entry.go
index 9b911b44..820a5306 100644
--- a/api/entry.go
+++ b/api/entry.go
@@ -127,13 +127,13 @@ func (h *handler) findEntries(w http.ResponseWriter, r *http.Request, feedID int
userID := request.UserID(r)
categoryID = request.QueryInt64Param(r, "category_id", categoryID)
if categoryID > 0 && !h.store.CategoryIDExists(userID, categoryID) {
- json.BadRequest(w, r, errors.New("Invalid category ID"))
+ json.BadRequest(w, r, errors.New("invalid category ID"))
return
}
feedID = request.QueryInt64Param(r, "feed_id", feedID)
if feedID > 0 && !h.store.FeedExists(userID, feedID) {
- json.BadRequest(w, r, errors.New("Invalid feed ID"))
+ json.BadRequest(w, r, errors.New("invalid feed ID"))
return
}
@@ -203,11 +203,12 @@ func (h *handler) saveEntry(w http.ResponseWriter, r *http.Request) {
builder := h.store.NewEntryQueryBuilder(request.UserID(r))
builder.WithEntryID(entryID)
builder.WithoutStatus(model.EntryStatusRemoved)
- // check if user has save entry enabled
+
if !h.store.HasSaveEntry(request.UserID(r)) {
- json.BadRequest(w, r, errors.New("at least one enabled integration is required"))
+ json.BadRequest(w, r, errors.New("no third-party integration enabled"))
return
}
+
entry, err := builder.GetEntry()
if err != nil {
json.ServerError(w, r, err)
@@ -225,11 +226,9 @@ func (h *handler) saveEntry(w http.ResponseWriter, r *http.Request) {
return
}
- go func() {
- integration.SendEntry(entry, settings)
- }()
+ go integration.SendEntry(entry, settings)
- json.NoContent(w, r)
+ json.Accepted(w, r)
}
func (h *handler) fetchContent(w http.ResponseWriter, r *http.Request) {