feat(cabana,pier): add Media Library admin API, mediafinder, Mail Images unification, and MCP tools

This commit is contained in:
Jakub Zych
2026-11-27 13:05:22 +01:00
parent 052aac4312
commit 2f0a44e504
32 changed files with 3882 additions and 69 deletions

View File

@@ -13,6 +13,7 @@ import (
"sync/atomic"
"time"
"git.golem15.com/golem15/summercms/modules/album"
"git.golem15.com/golem15/summercms/modules/backpack"
"git.golem15.com/golem15/summercms/modules/lagoon/attach"
"git.golem15.com/golem15/summercms/modules/pact"
@@ -1840,11 +1841,19 @@ func (b *MailBrandSetting) BeforeValidate(tx *gorm.DB) error {
if b.LogoFileID != nil {
var n int64
if err := tx.Session(&gorm.Session{NewDB: true}).
Table("system_files").
Where("id = ? AND attachment_type = ? AND field = ?", *b.LogoFileID, mailImageLibraryMorph, "images").
Table(album.ItemsTable).
Where("id = ? OR legacy_file_id = ?", *b.LogoFileID, *b.LogoFileID).
Count(&n).Error; err != nil {
return err
}
if n == 0 {
if err := tx.Session(&gorm.Session{NewDB: true}).
Table("system_files").
Where("id = ? AND attachment_type = ? AND field = ?", *b.LogoFileID, mailImageLibraryMorph, "images").
Count(&n).Error; err != nil {
return err
}
}
if n == 0 {
details["logo_file_id"] = []string{"backend::lang.mailimage.missing"}
}