feat(config): add sensitive word filtering system with database support
Implement sensitive word filtering feature with configurable database and Redis support. Add security enhancements including WebSocket origin validation, improved password strength requirements, timing attack prevention, and production JWT secret validation. Add batch operation validation limits and optimize user blocking queries with subqueries. BREAKING CHANGE: Password validation now requires minimum 8 characters with uppercase, lowercase, and digit (was 6-50 characters without complexity requirements)
This commit is contained in:
@@ -377,21 +377,15 @@ func (r *userRepository) BlockUserAndCleanupRelations(blockerID, blockedID strin
|
||||
}
|
||||
|
||||
for _, uid := range []string{blockerID, blockedID} {
|
||||
var followersCount int64
|
||||
if err := tx.Model(&model.Follow{}).Where("following_id = ?", uid).Count(&followersCount).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
if err := tx.Model(&model.User{}).Where("id = ?", uid).
|
||||
UpdateColumn("followers_count", followersCount).Error; err != nil {
|
||||
UpdateColumn("followers_count", tx.Model(&model.Follow{}).
|
||||
Select("COUNT(*)").Where("following_id = ?", uid)).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var followingCount int64
|
||||
if err := tx.Model(&model.Follow{}).Where("follower_id = ?", uid).Count(&followingCount).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
if err := tx.Model(&model.User{}).Where("id = ?", uid).
|
||||
UpdateColumn("following_count", followingCount).Error; err != nil {
|
||||
UpdateColumn("following_count", tx.Model(&model.Follow{}).
|
||||
Select("COUNT(*)").Where("follower_id = ?", uid)).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user