-
Notifications
You must be signed in to change notification settings - Fork 1.3k
refactor(db): 更新数据库模型更新方法以保留空值 && fix(chain): 修复消息隔离和发送逻辑问题 #5281
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
base: v2
Are you sure you want to change the base?
Conversation
- 移除更新方法中过滤空值的逻辑 - 确保数据库实体能够正确处理空值更新 - 保持异步和同步更新方法的一致性
Summary of ChangesHello @Seed680, 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
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
本次 PR 移除了数据库模型更新方法中对 None 值的过滤,这是一个正确的修复,确保了可以将字段值更新为 None。代码变更符合预期。我发现 update 和 async_update 方法中,用于重新构建 payload 的代码行在移除过滤逻辑后变得多余,建议移除以简化代码。具体细节请见我的评论。
| @db_update | ||
| def update(self, db: Session, payload: dict): | ||
| payload = {k: v for k, v in payload.items() if v is not None} | ||
| payload = {k: v for k, v in payload.items()} |
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.
| @async_db_update | ||
| async def async_update(self, db: AsyncSession, payload: dict): | ||
| payload = {k: v for k, v in payload.items() if v is not None} | ||
| payload = {k: v for k, v in payload.items()} |
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.
- 移除了消息隔离条件中的 userid 非空检查 - 在全体发送时重置 message.userid 为 None - 修复了消息按设置隔离的判断逻辑
- 移除了消息隔离条件中的 userid 非空检查 - 在全体发送时重置 message.userid 为 None - 修复了消息按设置隔离的判断逻辑
|
#5258 也提到过通知范围的问题 |
目前当通过更新的方式,删除一些已经存在的值时,由于进行了空值过滤,会导致无效。例如:更新订阅中的内容,先设置了指定下载器或者目录,但是后期想通过更新的方式删除相关设置时,由于空值过滤会导致无效。
fix(chain): 修复消息隔离和发送逻辑问题
当用户通过微信或者tg与mp交互订阅时,未按照设定的范围进行通知发送