mirror of
https://github.com/miniflux/v2.git
synced 2025-08-01 17:38:37 +00:00
Make the feed category optional for API clients who don't support categories
This commit is contained in:
parent
6dd090a848
commit
1350f84ea4
1 changed files with 10 additions and 0 deletions
|
@ -24,6 +24,16 @@ func (h *handler) createFeed(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make the feed category optional for clients who don't support categories.
|
||||||
|
if feedCreationRequest.CategoryID == 0 {
|
||||||
|
category, err := h.store.FirstCategory(userID)
|
||||||
|
if err != nil {
|
||||||
|
json.ServerError(w, r, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
feedCreationRequest.CategoryID = category.ID
|
||||||
|
}
|
||||||
|
|
||||||
if validationErr := validator.ValidateFeedCreation(h.store, userID, &feedCreationRequest); validationErr != nil {
|
if validationErr := validator.ValidateFeedCreation(h.store, userID, &feedCreationRequest); validationErr != nil {
|
||||||
json.BadRequest(w, r, validationErr.Error())
|
json.BadRequest(w, r, validationErr.Error())
|
||||||
return
|
return
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue