Conversation
WorldSansha
commented
Mar 5, 2026
- 在常规设置的其他设置中添加「评论区抱一抱」开关,默认开启
- 首次双击评论时弹出确认提示,避免用户误触
- 第二次取消时提供「取消且不再提示」选项,可直接关闭功能
- 重新开启开关时自动重置提示状态
- 限制抱一抱仅对歌曲评论生效,其他资源类型给出提示
- 在常规设置的其他设置中添加「评论区抱一抱」开关,默认开启 - 首次双击评论时弹出确认提示,避免用户误触 - 第二次取消时提供「取消且不再提示」选项,可直接关闭功能 - 重新开启开关时自动重置提示状态 - 限制抱一抱仅对歌曲评论生效,其他资源类型给出提示 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 此拉取请求旨在通过引入用户可控的开关和智能提示机制,增强评论区「抱一抱」功能的可用性和用户体验。它通过在设置中添加一个显式开关,并为首次使用提供确认提示,有效防止了误操作。此外,功能现在仅限于歌曲评论,确保了其在预期场景下的正确应用,从而提升了整体的用户交互质量。 Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This PR successfully introduces a 'hug' feature for comments, complete with a toggle switch and an initial usage prompt, demonstrating a thoughtful approach to user experience. A significant security concern has been identified: a potential Broken Access Control (IDOR) vulnerability, where the user's ID is passed as an API parameter, which could allow impersonation if the server trusts this parameter without sufficient validation. Furthermore, a check for 'UID login' mode is missing and should be added to align with other social features. On the code front, the hugTipDismissed state, currently a local component variable, should be moved to the Pinia store to ensure its persistence and provide a more consistent user experience across page navigations, including proper initialization and resetting when the feature is re-enabled.
| const handleDoubleClick = debounce(async (item: CommentType) => { | ||
| if (!settingStore.enableCommentHug) return; | ||
| // 首次双击提示 | ||
| if (!settingStore.showedCommentHugTip) { | ||
| window.$dialog.warning({ | ||
| title: "抱一抱", | ||
| content: "双击评论会向评论者发送「抱一抱」,是否继续?", | ||
| positiveText: "继续", | ||
| negativeText: hugTipDismissed ? "取消且不再提示" : "取消", | ||
| onPositiveClick: () => { | ||
| settingStore.showedCommentHugTip = true; | ||
| executeHug(item); | ||
| }, | ||
| onNegativeClick: () => { | ||
| if (hugTipDismissed) { | ||
| settingStore.showedCommentHugTip = true; | ||
| settingStore.enableCommentHug = false; | ||
| } | ||
| hugTipDismissed = true; | ||
| }, |
There was a problem hiding this comment.
为了实现状态持久化,这里应使用 store 中的 hugTipDismissed 状态,而不是组件内的局部变量。请在应用此建议后,手动移除第 168 行的 let hugTipDismissed = false;。
const handleDoubleClick = debounce(async (item: CommentType) => {
if (!settingStore.enableCommentHug) return;
// 首次双击提示
if (!settingStore.showedCommentHugTip) {
window.$dialog.warning({
title: "抱一抱",
content: "双击评论会向评论者发送「抱一抱」,是否继续?",
positiveText: "继续",
negativeText: settingStore.hugTipDismissed ? "取消且不再提示" : "取消",
onPositiveClick: () => {
settingStore.showedCommentHugTip = true;
executeHug(item);
},
onNegativeClick: () => {
if (settingStore.hugTipDismissed) {
settingStore.showedCommentHugTip = true;
settingStore.enableCommentHug = false;
}
settingStore.hugTipDismissed = true;
},
});
| settingStore.enableCommentHug = v; | ||
| if (v) settingStore.showedCommentHugTip = false; |
| /** 是否已显示过抱一抱提示 */ | ||
| showedCommentHugTip: boolean; |
| playerExpandAnimation: "up", | ||
| useOnlineService: true, | ||
| enableCommentHug: true, | ||
| showedCommentHugTip: false, |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
设置局部变量的原因: 用户可能已经忘了昨天取消过,看到「取消且不再提示」会觉得莫名其妙——"我什么时候被提示过了?为什么直接让我不再提示?" 局部变量(当前设计): 用户第一次双击 → 弹框,点「取消」 |
|