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:
2026-03-12 23:40:21 +08:00
parent 0a0cbacbcc
commit 1216423350
5 changed files with 138 additions and 76 deletions

View File

@@ -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,
)
}
}