Skip to content

Conversation

@Seed680
Copy link
Contributor

@Seed680 Seed680 commented Dec 26, 2025

  • 移除更新方法中过滤空值的逻辑
  • 确保数据库实体能够正确处理空值更新
  • 保持异步和同步更新方法的一致性

目前当通过更新的方式,删除一些已经存在的值时,由于进行了空值过滤,会导致无效。例如:更新订阅中的内容,先设置了指定下载器或者目录,但是后期想通过更新的方式删除相关设置时,由于空值过滤会导致无效。

fix(chain): 修复消息隔离和发送逻辑问题

  • 移除了消息隔离条件中的 userid 非空检查
  • 在全体发送时重置 message.userid 为 None
  • 修复了消息按设置隔离的判断逻辑
    当用户通过微信或者tg与mp交互订阅时,未按照设定的范围进行通知发送

- 移除更新方法中过滤空值的逻辑
- 确保数据库实体能够正确处理空值更新
- 保持异步和同步更新方法的一致性
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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!

此拉取请求旨在解决一个现有问题,即在更新数据库记录时,如果尝试将某个字段的值设置为 null(或 None),由于系统会过滤掉空值,导致该更新操作无效。通过移除更新方法中的空值过滤逻辑,现在可以显式地将字段更新为 null,从而允许用户删除或清除之前设置的特定配置,例如订阅中的下载器或目录设置。

Highlights

  • 移除空值过滤: 从同步和异步的数据库更新方法中移除了对空值的过滤逻辑。
  • 支持空值更新: 确保数据库实体在更新时能够正确处理和接受空值,从而允许清除现有数据。
  • 方法一致性: 保持了同步 update 和异步 async_update 方法在处理更新负载时的一致性。

🧠 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 Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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。代码变更符合预期。我发现 updateasync_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()}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

随着 if v is not None 过滤条件的移除,这一行代码现在变得多余了。它只是创建了 payload 字典的一个浅拷贝,而后续的循环可以直接使用原始的 payload。建议移除此行以简化代码并避免不必要的对象创建。

@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()}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

与同步的 update 方法类似,这一行代码在移除 None 值过滤后也变得多余。它创建了不必要的字典副本。建议移除此行,以提高代码的简洁性和效率。

- 移除了消息隔离条件中的 userid 非空检查
- 在全体发送时重置 message.userid 为 None
- 修复了消息按设置隔离的判断逻辑
@Seed680 Seed680 changed the title refactor(db): 更新数据库模型更新方法以保留空值 refactor(db): 更新数据库模型更新方法以保留空值 && fix(chain): 修复消息隔离和发送逻辑问题 Dec 26, 2025
- 移除了消息隔离条件中的 userid 非空检查
- 在全体发送时重置 message.userid 为 None
- 修复了消息按设置隔离的判断逻辑
@Seed680
Copy link
Contributor Author

Seed680 commented Dec 27, 2025

#5258 也提到过通知范围的问题

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.

1 participant