fix: set sort_order for newly installed apps to avoid random positioning (#12069)

This commit is contained in:
Rowan Chen
2026-03-05 15:43:18 +08:00
committed by GitHub
parent 98e2d6390a
commit 3a0d2039d0
+4
View File
@@ -516,6 +516,10 @@ func (a AppService) Install(req request.AppInstallCreate, executeScript bool) (a
}
appInstall.Env = string(paramByte)
var maxSort int
global.DB.Model(&model.AppInstall{}).Where("favorite = ?", false).Select("COALESCE(MAX(sort_order),0)").Scan(&maxSort)
appInstall.SortOrder = maxSort + 1
if err = appInstallRepo.Create(context.Background(), appInstall); err != nil {
return
}