admin: auto-sync tries to sync themes if it doesn't exists yet
This commit is contained in:
parent
63cf665f2d
commit
75eae43f60
@ -233,10 +233,32 @@ func autoSync(c *gin.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
if theTheme == nil {
|
||||
// The theme doesn't exists locally, perhaps it has not been imported already?
|
||||
rThemes, err := sync.GetThemes(sync.GlobalImporter)
|
||||
if err == nil {
|
||||
for _, theme := range rThemes {
|
||||
if theme == p {
|
||||
sync.SyncThemes(sync.GlobalImporter)
|
||||
|
||||
themes, err := fic.GetThemes()
|
||||
if err == nil {
|
||||
for _, theme := range themes {
|
||||
if theme.Path == p {
|
||||
theTheme = theme
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if theTheme == nil {
|
||||
c.AbortWithStatusJSON(http.StatusNotFound, gin.H{"errmsg": fmt.Sprintf("Theme not found %q", p)})
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if !IsProductionEnv {
|
||||
exercices, err := theTheme.GetExercices()
|
||||
|
Loading…
Reference in New Issue
Block a user