fix: 修复登录后白屏 + label标签闪屏
白屏: security.routes.js 缺少 security_settings_index 命名路由, SidebarGroup 的 router.resolve 抛错导致所有 sidebar 组件渲染失败. 修复: 添加命名子路由指向空占位组件. 闪屏: 后端 FilterParams.Labels 用 form:"labels" 绑定, 无法解析 Chatwoot 前端的 labels[] 数组参数, label 过滤从未生效. IntersectionObserver 检测到"还有更多数据"不断触发 loadMore, 8秒内发出 1000+ 次重复请求形成无限循环. 修复: 新增 LabelsArr []string 字段绑定 form:"labels[]", 在 handler 中合并到 Labels 字段.
This commit is contained in:
@@ -79,6 +79,15 @@ func (h *ConversationHandler) List(c *gin.Context) {
|
||||
response.AbortWithStatusError(c, http.StatusBadRequest, response.ErrValidation, err.Error())
|
||||
return
|
||||
}
|
||||
// Merge labels[] array params into Labels (comma-separated) for backward compat.
|
||||
// Chatwoot frontend sends labels[]=xxx as separate query params.
|
||||
if len(params.LabelsArr) > 0 {
|
||||
if params.Labels != "" {
|
||||
params.Labels = params.Labels + "," + strings.Join(params.LabelsArr, ",")
|
||||
} else {
|
||||
params.Labels = strings.Join(params.LabelsArr, ",")
|
||||
}
|
||||
}
|
||||
|
||||
result, svcErr := h.conversationSvc.ListWithFinder(c.Request.Context(), accountID, getUserID(c), params, p.Offset, p.PerPage)
|
||||
if svcErr != nil {
|
||||
@@ -522,6 +531,13 @@ func (h *ConversationHandler) Search(c *gin.Context) {
|
||||
response.AbortWithStatusError(c, http.StatusBadRequest, response.ErrValidation, err.Error())
|
||||
return
|
||||
}
|
||||
if len(params.LabelsArr) > 0 {
|
||||
if params.Labels != "" {
|
||||
params.Labels = params.Labels + "," + strings.Join(params.LabelsArr, ",")
|
||||
} else {
|
||||
params.Labels = strings.Join(params.LabelsArr, ",")
|
||||
}
|
||||
}
|
||||
|
||||
result, svcErr := h.conversationSvc.ListWithFinder(c.Request.Context(), accountID, getUserID(c), params, p.Offset, p.PerPage)
|
||||
if svcErr != nil {
|
||||
|
||||
Reference in New Issue
Block a user