🐛 Fix check user exists in realm bug

This commit is contained in:
LittleSheep 2024-12-01 12:18:09 +08:00
parent 17694d398b
commit 7a33018e44

View File

@ -72,7 +72,7 @@ func AddChannelMember(user authm.Account, target models.Channel) error {
if err := database.C.Where(&models.ChannelMember{ if err := database.C.Where(&models.ChannelMember{
AccountID: user.ID, AccountID: user.ID,
ChannelID: target.ID, ChannelID: target.ID,
}).First(&member).Error; err == nil || errors.Is(err, gorm.ErrRecordNotFound) { }).First(&member).Error; err == nil || !errors.Is(err, gorm.ErrRecordNotFound) {
return fmt.Errorf("the user is already in the channel") return fmt.Errorf("the user is already in the channel")
} }