mirror of
https://github.com/miniflux/v2.git
synced 2025-09-15 18:57:04 +00:00
Refactor feed validator
This commit is contained in:
parent
b35fece3d5
commit
806b9545a9
32 changed files with 588 additions and 521 deletions
|
@ -8,7 +8,6 @@ import (
|
|||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"miniflux.app/errors"
|
||||
"miniflux.app/model"
|
||||
)
|
||||
|
||||
|
@ -31,14 +30,6 @@ type FeedForm struct {
|
|||
Disabled bool
|
||||
}
|
||||
|
||||
// ValidateModification validates FeedForm fields
|
||||
func (f FeedForm) ValidateModification() error {
|
||||
if f.FeedURL == "" || f.SiteURL == "" || f.Title == "" || f.CategoryID == 0 {
|
||||
return errors.NewLocalizedError("error.fields_mandatory")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Merge updates the fields of the given feed.
|
||||
func (f FeedForm) Merge(feed *model.Feed) *model.Feed {
|
||||
feed.Category.ID = f.CategoryID
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue