Skip to content
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

fix: when user gold is negative, free plugins is also blocked #1699

Merged
merged 1 commit into from
Oct 16, 2024

Conversation

noahzark
Copy link
Contributor

@noahzark noahzark commented Oct 16, 2024

某种情况下(历史数据迁移、主动扣除金币),当用户金币为负数时,即使是免费插件也无法使用

Summary by Sourcery

错误修复:

  • 修复了免费插件因用户金币余额为负而被阻止的问题。
Original summary in English

Summary by Sourcery

Bug Fixes:

  • Fix issue where free plugins were blocked for users with negative gold balance.

Copy link

sourcery-ai bot commented Oct 16, 2024

审核者指南 by Sourcery

此拉取请求修复了一个错误,当用户的金币余额为负时,免费插件被阻止。此更改修改了检查用户是否有足够金币使用插件的条件。

未生成图表,因为更改看起来简单,不需要视觉表示。

文件级更改

更改 详情 文件
修改了检查用户是否有足够金币使用插件的条件
  • 添加了一个额外的检查,以确保插件的费用大于0
  • 这允许即使用户的金币余额为负时也能使用免费插件(cost_gold = 0)
zhenxun/builtin_plugins/hooks/_auth_checker.py

提示和命令

与 Sourcery 互动

  • 触发新审核: 在拉取请求上评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审核评论。
  • 从审核评论生成 GitHub 问题: 通过回复审核评论请求 Sourcery 创建一个问题。
  • 生成拉取请求标题: 在拉取请求标题的任何地方写 @sourcery-ai 以随时生成标题。
  • 生成拉取请求摘要: 在拉取请求正文的任何地方写 @sourcery-ai summary 以随时生成 PR 摘要。您也可以使用此命令指定摘要应插入的位置。

自定义您的体验

访问您的仪表板以:

  • 启用或禁用审核功能,如 Sourcery 生成的拉取请求摘要、审核者指南等。
  • 更改审核语言。
  • 添加、删除或编辑自定义审核说明。
  • 调整其他审核设置。

获取帮助

Original review guide in English

Reviewer's Guide by Sourcery

This pull request fixes a bug where free plugins were blocked when a user's gold balance was negative. The change modifies the condition for checking if a user has enough gold to use a plugin.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Modified the condition for checking if a user has enough gold to use a plugin
  • Added an additional check to ensure the plugin's cost is greater than 0
  • This allows free plugins (cost_gold = 0) to be used even when the user's gold balance is negative
zhenxun/builtin_plugins/hooks/_auth_checker.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

@noahzark - 我已经审查了你的更改 - 这里有一些反馈:

总体评论

  • 考虑审查黄金余额系统的整体设计。虽然这个修复解决了当前的问题,但允许负余额或基于黄金数量阻止访问可能会有更广泛的影响,可以通过更全面的方式解决。
这是我在审查期间查看的内容
  • 🟢 一般问题:一切看起来都很好
  • 🟢 安全性:一切看起来都很好
  • 🟢 测试:一切看起来都很好
  • 🟢 复杂性:一切看起来都很好
  • 🟢 文档:一切看起来都很好

Sourcery 对开源项目免费 - 如果你喜欢我们的评论,请考虑分享它们 ✨
帮助我变得更有用!请点击每条评论上的 👍 或 👎,我将使用反馈来改进你的评论。
Original comment in English

Hey @noahzark - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider reviewing the overall design of the gold balance system. While this fix addresses the immediate issue, there might be broader implications of allowing negative balances or blocking access based on gold amounts that could be addressed in a more comprehensive manner.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@HibiKier HibiKier merged commit 8531c07 into HibiKier:dev Oct 16, 2024
2 checks passed
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.

2 participants