feat(sns): 新增朋友圈评论筛选功能,支持搜索特定好友的所有评论#940
Conversation
laoshuikaixue
commented
May 9, 2026
- 在筛选面板新增"仅看某好友评论"按钮,支持在所有朋友圈或指定人朋友圈中筛选特定好友的评论
- 实现 fallback 匹配策略:因微信数据库评论缺少 username,通过获取联系人昵称/备注/alias 等多字段进行昵称匹配,并解析 rawXml 兜底
- 修复搜索结果中昵称与备注名不一致问题:强制将命中目标联系人的昵称替换为 remark/displayName,确保搜索结果与常规页面显示一致
- 扩大批量获取与重试次数(batchLimit=200, MAX_RETRIES=50),保证深层历史数据完整拉取
- 在筛选面板新增"仅看某好友评论"按钮,支持在所有朋友圈或指定人朋友圈中筛选特定好友的评论 - 实现 fallback 匹配策略:因微信数据库评论缺少 username,通过获取联系人昵称/备注/alias 等多字段进行昵称匹配,并解析 rawXml 兜底 - 修复搜索结果中昵称与备注名不一致问题:强制将命中目标联系人的昵称替换为 remark/displayName,确保搜索结果与常规页面显示一致 - 扩大批量获取与重试次数(batchLimit=200, MAX_RETRIES=50),保证深层历史数据完整拉取
|
@gemini-code-assist review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a439609a2b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const dllComments: any[] = post.comments || [] | ||
| let match = false; | ||
| for (const c of dllComments) { | ||
| if (c.username === commentByUsername || targetNicknames.includes(c.nickname) || c.nickname === commentSearchKeyword || c.nickname === commentByUsername) { |
There was a problem hiding this comment.
Restrict nickname fallback to comments without username
The comment filter treats any nickname match as a hit even when the comment already has a different username, so two contacts sharing the same display name can cause false positives (posts from the wrong person are included). This also feeds the later name-override path and can relabel another user's comment as the target user. The nickname fallback should only run when c.username is missing (or otherwise untrusted), and username matches should take precedence when present.
Useful? React with 👍 / 👎.
| if (!result.success) { | ||
| if (resultTimeline.length === 0) { | ||
| return result; | ||
| } | ||
| break; |
There was a problem hiding this comment.
Preserve success when later batch fetch fails after matches
In the batched commentByUsername path, if an early batch yields matched posts but a later getSnsTimeline call fails, the loop breaks without setting finalSuccess, so the function returns success: false even though timeline already contains valid results. Current callers gate on result.success, so these matched posts are effectively dropped from the UI/export on transient mid-scan failures. Marking the result as successful (or returning partial data explicitly) when resultTimeline is non-empty avoids this regression.
Useful? React with 👍 / 👎.
- 提取用户名和昵称匹配条件为独立变量,提高代码可读性 - 统一处理用户名存在与否的判断逻辑,避免重复条件检查 - 添加 finalSuccess 标志确保正常流程执行完成 - 分别处理评论和引用评论的昵称替换逻辑,避免混淆
|
解决一下合并问题,同时不建议做多层fallback,数据量一大会造成明显卡顿,并且错误匹配的情况似乎存在 |
…h-and-remark-fix # Conflicts: # src/components/Sns/SnsFilterPanel.tsx
- 移除多余的昵称字段映射,只保留 nickname 相关字段 - 注释掉 displayName 匹配逻辑以避免错误匹配 - 合并关键词搜索条件,统一使用 keyword 或 commentSearchKeyword - 删除 XML 解析相关的注释匹配代码 - 简化关键词匹配逻辑,移除重复的 XML 内容检查 - 优化数据库查询参数传递,避免不必要的全局拉取
Done. 在无全局搜索词时利用目标昵称作为 SQL |
|
这个精度太差了吧,几百条评论就搜出来一两个 |
|
我草,这跟我的PR没重吧 |
|
我修完了才看着这PR |
