-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
feat: add opt-in real nickname controls #8713
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Sisyphbaous-DT-Project
wants to merge
7
commits into
AstrBotDevs:master
Choose a base branch
from
Sisyphbaous-DT-Project:feat/real-nickname-controls
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
12cf97f
feat: 添加真实昵称展示控制
Sisyphbaous-DT-Project caa2c64
fix: 调整配置项过渡动画
Sisyphbaous-DT-Project 5c4fa2a
revert: 恢复配置项折叠高度动画
Sisyphbaous-DT-Project 418845e
refactor: 移除配置项过渡动画改动
Sisyphbaous-DT-Project dfaa15e
fix: 恢复配置项样式类名
Sisyphbaous-DT-Project b722f12
refactor: 梳理真实昵称元数据逻辑
Sisyphbaous-DT-Project f002034
refactor: 精简真实昵称处理流程
Sisyphbaous-DT-Project File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
输入空白字符组成的字符串会输出None.
也许有风险?我不确定会不会有什么平台允许空白字符当昵称。
或许把两个方法反一下,
_sanitize_metadata_value过滤None为字符串会好些?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我觉得不应该改。这是符合我们需求的
真实昵称是可选补充信息,如果清洗后只剩空白,就应该视为“不可用”,然后回退到群昵称。我们甚至已经有测试覆盖这个行为:test_append_system_reminders_real_only_falls_back_after_sanitizing。如果这里不返回 None,反而可能导致“仅真实昵称”模式把正常群昵称替换成空昵称,这才是风险
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的。
我注意到你的代码路径中,原始用户群昵称也经过了sanitized_user_nickname.
如果原始昵称为空白字符的话,最终到达user_metadata.nickname的值会是一个空字符串,没有任何字符。这里会有问题吗?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个问题确实存在,如果有平台可以将原始昵称和群昵称都改成空白,当前的代码状态的确也是传一个空白的昵称进去,不过这是原本就存在的一个小问题,而且当前的逻辑已经比较完备了。假设有平台能做到这样,那么原版的代码也是传一个空白昵称进去,我已经做了挺多加固了,比如说这个平台的某个用户,群昵称是正常的但是真实昵称改成了空白,当前的代码逻辑在不开启“仅使用真实昵称”的情况下也是把群昵称和真实昵称一起传进去,如果使用者开了只传真实昵称的这个功能,代码检测到某一个用户的昵称清洗完是空白,也会fallback到群昵称传进去,针对群昵称和原始昵称都是空白的状态,我目前还没有想到十分完美的解决方案,以后可能可以开个新的PR来单独讨论和优化一下