feat(group): refactor group invite workflow for improved user experience
- Simplify InviteMembers to always send invite card directly to invitee - Modify RespondInvite to check group join type (anyone vs need approval) before adding member - Update SetGroupAddRequest to properly handle invite flow with invitee agreement and admin approval stages - Add case-insensitive search using LOWER() in user repository - Add random offset (0-50) for first page of recommended posts - Update dependencies: remove gorilla/websocket, promote gomail to direct dependency
This commit is contained in:
@@ -2,6 +2,7 @@ package repository
|
||||
|
||||
import (
|
||||
"carrot_bbs/internal/model"
|
||||
"strings"
|
||||
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
@@ -341,8 +342,12 @@ func (r *UserRepository) Search(keyword string, page, pageSize int) ([]*model.Us
|
||||
keyword,
|
||||
)
|
||||
} else {
|
||||
searchPattern := "%" + keyword + "%"
|
||||
query = query.Where("username LIKE ? OR nickname LIKE ? OR bio LIKE ?", searchPattern, searchPattern, searchPattern)
|
||||
// SQLite: 使用 LOWER() 实现大小写不敏感的模糊搜索
|
||||
lowerSearchPattern := "%" + strings.ToLower(keyword) + "%"
|
||||
query = query.Where(
|
||||
"LOWER(username) LIKE ? OR LOWER(nickname) LIKE ? OR LOWER(bio) LIKE ?",
|
||||
lowerSearchPattern, lowerSearchPattern, lowerSearchPattern,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user