List Background upload (#582)
Add filesize check when uploading a new file Fix error 500 if the uploaded background was not an unsplash one Add upload background setting to info endpoint Add config docs Fix lint Return list background type if it was uploaded Add file upload Add docs Save uploaded backgrounds as file Add background upload handler Co-authored-by: kolaente <k@knt.li> Reviewed-on: https://kolaente.dev/vikunja/api/pulls/582
This commit is contained in:
@ -66,6 +66,14 @@ type List struct {
|
||||
web.Rights `xorm:"-" json:"-"`
|
||||
}
|
||||
|
||||
// ListBackgroundType holds a list background type
|
||||
type ListBackgroundType struct {
|
||||
Type string
|
||||
}
|
||||
|
||||
// ListBackgroundUpload represents the list upload background type
|
||||
const ListBackgroundUpload string = "upload"
|
||||
|
||||
// GetListsByNamespaceID gets all lists in a namespace
|
||||
func GetListsByNamespaceID(nID int64, doer *user.User) (lists []*List, err error) {
|
||||
if nID == -1 {
|
||||
@ -175,11 +183,15 @@ func (l *List) ReadOne() (err error) {
|
||||
|
||||
// Get any background information if there is one set
|
||||
if l.BackgroundFileID != 0 {
|
||||
// Currently unsplash only
|
||||
// Unsplash image
|
||||
l.BackgroundInformation, err = GetUnsplashPhotoByFileID(l.BackgroundFileID)
|
||||
if err != nil && !files.IsErrFileIsNotUnsplashFile(err) {
|
||||
return
|
||||
}
|
||||
|
||||
if err != nil && files.IsErrFileIsNotUnsplashFile(err) {
|
||||
l.BackgroundInformation = &ListBackgroundType{Type: ListBackgroundUpload}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
|
Reference in New Issue
Block a user