Merge branch 'main' into feature/caldav-subtasks
This commit is contained in:
commit
fbaf2c182d
@ -438,6 +438,7 @@ steps:
|
||||
# This path does not exist. However, when we set the gopath to /go, the build fails. Not sure why.
|
||||
# Leaving this here until we know how to resolve this properly.
|
||||
GOPATH: /srv/app
|
||||
GOPROXY: https://goproxy.kolaente.de
|
||||
commands:
|
||||
- export PATH=$PATH:$GOPATH/bin
|
||||
- go install github.com/magefile/mage
|
||||
@ -451,6 +452,7 @@ steps:
|
||||
# This path does not exist. However, when we set the gopath to /go, the build fails. Not sure why.
|
||||
# Leaving this here until we know how to resolve this properly.
|
||||
GOPATH: /srv/app
|
||||
GOPROXY: https://goproxy.kolaente.de
|
||||
commands:
|
||||
- export PATH=$PATH:$GOPATH/bin
|
||||
- go install github.com/magefile/mage
|
||||
@ -464,6 +466,7 @@ steps:
|
||||
# This path does not exist. However, when we set the gopath to /go, the build fails. Not sure why.
|
||||
# Leaving this here until we know how to resolve this properly.
|
||||
GOPATH: /srv/app
|
||||
GOPROXY: https://goproxy.kolaente.de
|
||||
commands:
|
||||
- export PATH=$PATH:$GOPATH/bin
|
||||
- go install github.com/magefile/mage
|
||||
@ -775,6 +778,6 @@ steps:
|
||||
- failure
|
||||
---
|
||||
kind: signature
|
||||
hmac: b32ea5780ab6c4e57f201ec468357340349591a3026c96efd669a0b9c10f0e34
|
||||
hmac: 6bc74f5b7e9c51e725100e05f07cdac656d6c3d49d19c2b112aed812c86e7a9a
|
||||
|
||||
...
|
||||
|
@ -13,6 +13,7 @@ COPY . ./
|
||||
|
||||
ARG TARGETOS TARGETARCH TARGETVARIANT
|
||||
|
||||
ENV GOPROXY https://goproxy.kolaente.de
|
||||
RUN export PATH=$PATH:$GOPATH/bin && \
|
||||
mage build:clean && \
|
||||
mage release:xgo "${TARGETOS}/${TARGETARCH}/${TARGETVARIANT}"
|
||||
|
@ -453,9 +453,6 @@ func (Build) Clean() error {
|
||||
if err := os.RemoveAll(BinLocation); err != nil && !os.IsNotExist(err) {
|
||||
return err
|
||||
}
|
||||
if err := os.RemoveAll(swaggerDocsFolderLocation); err != nil && !os.IsNotExist(err) {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ func init() {
|
||||
ID: "20230828125443",
|
||||
Description: "",
|
||||
Migrate: func(tx *xorm.Engine) error {
|
||||
return tx.Sync2(typesenseSync20230828125443{})
|
||||
return tx.CreateTables(typesenseSync20230828125443{})
|
||||
},
|
||||
Rollback: func(tx *xorm.Engine) error {
|
||||
return nil
|
||||
|
@ -59,6 +59,7 @@ func GetTables() []interface{} {
|
||||
&Subscription{},
|
||||
&Favorite{},
|
||||
&APIToken{},
|
||||
&TypesenseSync{},
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1030,7 +1030,12 @@ func (p *Project) DeleteBackgroundFileIfExists() (err error) {
|
||||
}
|
||||
|
||||
file := files.File{ID: p.BackgroundFileID}
|
||||
return file.Delete()
|
||||
err = file.Delete()
|
||||
if err != nil && files.IsErrFileDoesNotExist(err) {
|
||||
return nil
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// SetProjectBackground sets a background file as project background in the db
|
||||
|
@ -118,43 +118,9 @@ func (pd *ProjectDuplicate) Create(s *xorm.Session, doer web.Auth) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// Background files + unsplash info
|
||||
if pd.Project.BackgroundFileID != 0 {
|
||||
|
||||
log.Debugf("Duplicating background %d from project %d into %d", pd.Project.BackgroundFileID, pd.ProjectID, pd.Project.ID)
|
||||
|
||||
f := &files.File{ID: pd.Project.BackgroundFileID}
|
||||
if err := f.LoadFileMetaByID(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := f.LoadFileByID(); err != nil {
|
||||
return err
|
||||
}
|
||||
defer f.File.Close()
|
||||
|
||||
file, err := files.Create(f.File, f.Name, f.Size, doer)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Get unsplash info if applicable
|
||||
up, err := GetUnsplashPhotoByFileID(s, pd.Project.BackgroundFileID)
|
||||
if err != nil && files.IsErrFileIsNotUnsplashFile(err) {
|
||||
return err
|
||||
}
|
||||
if up != nil {
|
||||
up.ID = 0
|
||||
up.FileID = file.ID
|
||||
if err := up.Save(s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if err := SetProjectBackground(s, pd.Project.ID, file, pd.Project.BackgroundBlurHash); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
log.Debugf("Duplicated project background from project %d into %d", pd.ProjectID, pd.Project.ID)
|
||||
err = duplicateProjectBackground(s, pd, doer)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Rights / Shares
|
||||
@ -207,6 +173,54 @@ func (pd *ProjectDuplicate) Create(s *xorm.Session, doer web.Auth) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func duplicateProjectBackground(s *xorm.Session, pd *ProjectDuplicate, doer web.Auth) (err error) {
|
||||
if pd.Project.BackgroundFileID == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
log.Debugf("Duplicating background %d from project %d into %d", pd.Project.BackgroundFileID, pd.ProjectID, pd.Project.ID)
|
||||
|
||||
f := &files.File{ID: pd.Project.BackgroundFileID}
|
||||
err = f.LoadFileMetaByID()
|
||||
if err != nil && files.IsErrFileDoesNotExist(err) {
|
||||
pd.Project.BackgroundFileID = 0
|
||||
return nil
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := f.LoadFileByID(); err != nil {
|
||||
return err
|
||||
}
|
||||
defer f.File.Close()
|
||||
|
||||
file, err := files.Create(f.File, f.Name, f.Size, doer)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Get unsplash info if applicable
|
||||
up, err := GetUnsplashPhotoByFileID(s, pd.Project.BackgroundFileID)
|
||||
if err != nil && !files.IsErrFileIsNotUnsplashFile(err) {
|
||||
return err
|
||||
}
|
||||
if up != nil {
|
||||
up.ID = 0
|
||||
up.FileID = file.ID
|
||||
if err := up.Save(s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if err := SetProjectBackground(s, pd.Project.ID, file, pd.Project.BackgroundBlurHash); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
log.Debugf("Duplicated project background from project %d into %d", pd.ProjectID, pd.Project.ID)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func duplicateTasks(s *xorm.Session, doer web.Auth, ld *ProjectDuplicate, bucketMap map[int64]int64) (err error) {
|
||||
// Get all tasks + all task details
|
||||
tasks, _, _, err := getTasksForProjects(s, []*Project{{ID: ld.ProjectID}}, doer, &taskSearchOptions{})
|
||||
|
@ -329,8 +329,7 @@ func TestProject_DeleteBackgroundFileIfExists(t *testing.T) {
|
||||
err := SetProjectBackground(s, project.ID, file, "")
|
||||
assert.NoError(t, err)
|
||||
err = project.DeleteBackgroundFileIfExists()
|
||||
assert.Error(t, err)
|
||||
assert.True(t, files.IsErrFileDoesNotExist(err))
|
||||
assert.NoError(t, err)
|
||||
})
|
||||
t.Run("project without background", func(t *testing.T) {
|
||||
db.LoadAndAssertFixtures(t)
|
||||
|
@ -243,6 +243,12 @@ func ReindexAllTasks() (err error) {
|
||||
}
|
||||
|
||||
func reindexTasks(s *xorm.Session, tasks map[int64]*Task) (err error) {
|
||||
|
||||
if len(tasks) == 0 {
|
||||
log.Infof("No tasks to index")
|
||||
return
|
||||
}
|
||||
|
||||
err = addMoreInfoToTasks(s, tasks, &user.User{ID: 1})
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not fetch more task info: %s", err.Error())
|
||||
|
@ -291,11 +291,13 @@ func (p *Provider) Set(s *xorm.Session, image *background.Image, project *models
|
||||
// Remove the old background if one exists
|
||||
if project.BackgroundFileID != 0 {
|
||||
file := files.File{ID: project.BackgroundFileID}
|
||||
if err := file.Delete(); err != nil {
|
||||
err = file.Delete()
|
||||
if err != nil && !files.IsErrFileDoesNotExist(err) {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := models.RemoveUnsplashPhoto(s, project.BackgroundFileID); err != nil {
|
||||
err = models.RemoveUnsplashPhoto(s, project.BackgroundFileID)
|
||||
if err != nil && !files.IsErrFileDoesNotExist(err) {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,8 @@ func (p *Provider) Set(s *xorm.Session, img *background.Image, project *models.P
|
||||
// Remove the old background if one exists
|
||||
if project.BackgroundFileID != 0 {
|
||||
file := files.File{ID: project.BackgroundFileID}
|
||||
if err := file.Delete(); err != nil {
|
||||
err := file.Delete()
|
||||
if err != nil && !files.IsErrFileDoesNotExist(err) {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user