Commit f4978a93 authored by Lukas Böhm's avatar Lukas Böhm 🎱
Browse files

better store emails

parent 4d09c023
...@@ -40,7 +40,7 @@ type Attachment struct { ...@@ -40,7 +40,7 @@ type Attachment struct {
/////////// Hoooks ////////////// /////////// Hoooks //////////////
///////////////////////////////// /////////////////////////////////
func (sh *Share) AfterFind(scope *gorm.DB) error { func (sh *Share) AfterFind(scope *gorm.DB) error {
sh.Emails = []string{sh.EMailsDB} sh.Emails = strings.Split(sh.EMailsDB, ";")
return nil return nil
} }
...@@ -54,11 +54,14 @@ func (sh *Share) BeforeCreate(scope *gorm.DB) error { ...@@ -54,11 +54,14 @@ func (sh *Share) BeforeCreate(scope *gorm.DB) error {
} }
// create temporary dir // create temporary dir
if sh.IsTemporary == true { if sh.IsTemporary == true {
return os.MkdirAll(filepath.Join(config.mediaDir, "temp", sh.ID.String()), os.ModePerm) if err := os.MkdirAll(filepath.Join(config.mediaDir, "temp", sh.ID.String()), os.ModePerm); err != nil { return nil }
} else { } else {
return os.MkdirAll(filepath.Join(config.mediaDir, "data", sh.ID.String()), os.ModePerm) if err:= os.MkdirAll(filepath.Join(config.mediaDir, "data", sh.ID.String()), os.ModePerm); err != nil { return nil }
} }
// TODO convert email adresses //convert email adresses
sh.EMailsDB = strings.Join(sh.Emails,";")
return nil
} }
func (sh *Share) BeforeDelete(scope *gorm.DB) error { func (sh *Share) BeforeDelete(scope *gorm.DB) error {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment