🐛 Fix get available channel in global also read channels in realm

This commit is contained in:
LittleSheep 2024-10-05 22:04:15 +08:00
parent a3ef3d52d7
commit afb3b939e7

View File

@ -156,6 +156,8 @@ func ListAvailableChannel(tx *gorm.DB, user models.Account, realmId ...uint) ([]
tx = tx.Preload("Realm").Where("id IN ?", idx)
if len(realmId) > 0 {
tx = tx.Where("realm_id = ?", realmId)
} else {
tx = tx.Where("realm_id IS NULL")
}
tx = PreloadDirectChannelMembers(tx)