Skip to content

feat(sns): 新增朋友圈评论筛选功能,支持搜索特定好友的所有评论#940

Open
laoshuikaixue wants to merge 6 commits into
hicccc77:devfrom
laoshuikaixue:feat/sns-comment-search-and-remark-fix
Open

feat(sns): 新增朋友圈评论筛选功能,支持搜索特定好友的所有评论#940
laoshuikaixue wants to merge 6 commits into
hicccc77:devfrom
laoshuikaixue:feat/sns-comment-search-and-remark-fix

Conversation

@laoshuikaixue
Copy link
Copy Markdown

  • 在筛选面板新增"仅看某好友评论"按钮,支持在所有朋友圈或指定人朋友圈中筛选特定好友的评论
  • 实现 fallback 匹配策略:因微信数据库评论缺少 username,通过获取联系人昵称/备注/alias 等多字段进行昵称匹配,并解析 rawXml 兜底
  • 修复搜索结果中昵称与备注名不一致问题:强制将命中目标联系人的昵称替换为 remark/displayName,确保搜索结果与常规页面显示一致
  • 扩大批量获取与重试次数(batchLimit=200, MAX_RETRIES=50),保证深层历史数据完整拉取

- 在筛选面板新增"仅看某好友评论"按钮,支持在所有朋友圈或指定人朋友圈中筛选特定好友的评论
- 实现 fallback 匹配策略:因微信数据库评论缺少 username,通过获取联系人昵称/备注/alias 等多字段进行昵称匹配,并解析 rawXml 兜底
- 修复搜索结果中昵称与备注名不一致问题:强制将命中目标联系人的昵称替换为 remark/displayName,确保搜索结果与常规页面显示一致
- 扩大批量获取与重试次数(batchLimit=200, MAX_RETRIES=50),保证深层历史数据完整拉取
@laoshuikaixue
Copy link
Copy Markdown
Author

image

如题,支持朋友圈评论筛选,以及在朋友圈页面展示备注的好友姓名

@laoshuikaixue
Copy link
Copy Markdown
Author

@gemini-code-assist review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread electron/services/snsService.ts Outdated
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) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Comment on lines +1223 to +1227
if (!result.success) {
if (resultTimeline.length === 0) {
return result;
}
break;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 标志确保正常流程执行完成
- 分别处理评论和引用评论的昵称替换逻辑,避免混淆
@hicccc77 hicccc77 changed the base branch from main to dev May 10, 2026 03:36
@hicccc77
Copy link
Copy Markdown
Owner

解决一下合并问题,同时不建议做多层fallback,数据量一大会造成明显卡顿,并且错误匹配的情况似乎存在

hicccc77 and others added 4 commits May 10, 2026 12:05
…h-and-remark-fix

# Conflicts:
#	src/components/Sns/SnsFilterPanel.tsx
- 移除多余的昵称字段映射,只保留 nickname 相关字段
- 注释掉 displayName 匹配逻辑以避免错误匹配
- 合并关键词搜索条件,统一使用 keyword 或 commentSearchKeyword
- 删除 XML 解析相关的注释匹配代码
- 简化关键词匹配逻辑,移除重复的 XML 内容检查
- 优化数据库查询参数传递,避免不必要的全局拉取
@laoshuikaixue
Copy link
Copy Markdown
Author

laoshuikaixue commented May 10, 2026

解决一下合并问题,同时不建议做多层fallback,数据量一大会造成明显卡顿,并且错误匹配的情况似乎存在

Done. 在无全局搜索词时利用目标昵称作为 SQL LIKE 过滤条件、移除了循环内对 rawXml 的多层 parseCommentsFromXml 解析

@hicccc77
Copy link
Copy Markdown
Owner

这个精度太差了吧,几百条评论就搜出来一两个

@nDhnzr6r
Copy link
Copy Markdown

我草,这跟我的PR没重吧

@nDhnzr6r
Copy link
Copy Markdown

我修完了才看着这PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants