🗑️ Remove account preload
This commit is contained in:
parent
2d05be679d
commit
ed73b40bf5
@ -109,7 +109,7 @@ func NewCall(channel models.Channel, founder models.ChannelMember) (models.Call,
|
|||||||
return call, err
|
return call, err
|
||||||
} else if err = database.C.Where(models.ChannelMember{
|
} else if err = database.C.Where(models.ChannelMember{
|
||||||
ChannelID: call.ChannelID,
|
ChannelID: call.ChannelID,
|
||||||
}).Preload("Account").Find(&members).Error; err == nil {
|
}).Find(&members).Error; err == nil {
|
||||||
call, _ = GetCall(call.Channel, call.ID)
|
call, _ = GetCall(call.Channel, call.ID)
|
||||||
var pendingUsers []uint64
|
var pendingUsers []uint64
|
||||||
for _, member := range members {
|
for _, member := range members {
|
||||||
@ -169,7 +169,7 @@ func EndCall(call models.Call) (models.Call, error) {
|
|||||||
return call, err
|
return call, err
|
||||||
} else if err = database.C.Where(models.ChannelMember{
|
} else if err = database.C.Where(models.ChannelMember{
|
||||||
ChannelID: call.ChannelID,
|
ChannelID: call.ChannelID,
|
||||||
}).Preload("Account").Find(&members).Error; err == nil {
|
}).Find(&members).Error; err == nil {
|
||||||
call, _ = GetCall(call.Channel, call.ID)
|
call, _ = GetCall(call.Channel, call.ID)
|
||||||
for _, member := range members {
|
for _, member := range members {
|
||||||
PushCommand(member.AccountID, nex.WebSocketPackage{
|
PushCommand(member.AccountID, nex.WebSocketPackage{
|
||||||
|
@ -20,7 +20,6 @@ func ListChannelMember(channelId uint) ([]models.ChannelMember, error) {
|
|||||||
|
|
||||||
if err := database.C.
|
if err := database.C.
|
||||||
Where(&models.ChannelMember{ChannelID: channelId}).
|
Where(&models.ChannelMember{ChannelID: channelId}).
|
||||||
Preload("Account").
|
|
||||||
Find(&members).Error; err != nil {
|
Find(&members).Error; err != nil {
|
||||||
return members, err
|
return members, err
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ func GetChannelAliasAvailability(alias string) error {
|
|||||||
|
|
||||||
func GetChannel(id uint) (models.Channel, error) {
|
func GetChannel(id uint) (models.Channel, error) {
|
||||||
var channel models.Channel
|
var channel models.Channel
|
||||||
tx := database.C.Where("id = ?", id).Preload("Account").Preload("Realm")
|
tx := database.C.Where("id = ?", id).Preload("Realm")
|
||||||
tx = PreloadDirectChannelMembers(tx)
|
tx = PreloadDirectChannelMembers(tx)
|
||||||
if err := tx.First(&channel).Error; err != nil {
|
if err := tx.First(&channel).Error; err != nil {
|
||||||
return channel, err
|
return channel, err
|
||||||
@ -103,7 +103,7 @@ func GetChannel(id uint) (models.Channel, error) {
|
|||||||
|
|
||||||
func GetChannelWithAlias(alias string, realmId ...uint) (models.Channel, error) {
|
func GetChannelWithAlias(alias string, realmId ...uint) (models.Channel, error) {
|
||||||
var channel models.Channel
|
var channel models.Channel
|
||||||
tx := database.C.Where(models.Channel{Alias: alias}).Preload("Account").Preload("Realm")
|
tx := database.C.Where(models.Channel{Alias: alias}).Preload("Realm")
|
||||||
if len(realmId) > 0 {
|
if len(realmId) > 0 {
|
||||||
tx = tx.Where("realm_id = ?", realmId)
|
tx = tx.Where("realm_id = ?", realmId)
|
||||||
} else {
|
} else {
|
||||||
@ -178,7 +178,7 @@ func ListChannel(user *authm.Account, realmId ...uint) ([]models.Channel, error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
var channels []models.Channel
|
var channels []models.Channel
|
||||||
tx := database.C.Preload("Account").Preload("Realm")
|
tx := database.C.Preload("Realm")
|
||||||
tx = tx.Where("id IN ? OR is_public = true", idRange)
|
tx = tx.Where("id IN ? OR is_public = true", idRange)
|
||||||
if len(realmId) > 0 {
|
if len(realmId) > 0 {
|
||||||
tx = tx.Where("realm_id = ?", realmId)
|
tx = tx.Where("realm_id = ?", realmId)
|
||||||
|
@ -77,7 +77,7 @@ func NewEvent(event models.Event) (models.Event, error) {
|
|||||||
return event, err
|
return event, err
|
||||||
} else if err = database.C.Where(models.ChannelMember{
|
} else if err = database.C.Where(models.ChannelMember{
|
||||||
ChannelID: event.ChannelID,
|
ChannelID: event.ChannelID,
|
||||||
}).Preload("Account").Find(&members).Error; err != nil {
|
}).Find(&members).Error; err != nil {
|
||||||
// Couldn't get channel members, skip notifying
|
// Couldn't get channel members, skip notifying
|
||||||
return event, nil
|
return event, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user