Skip to content

fix: application chat user quota setting permission - #7964

Merged
peslyn merged 1 commit into
v3from
pr@v3@fix_application_chat_user_quota_setting_permission
Nov 17, 2026
Merged

peslyn merged 1 commit into
v3from
pr@v3@fix_application_chat_user_quota_setting_permission

Conversation

@shaohuzhang1

Copy link
Copy Markdown
Contributor

fix: application chat user quota setting permission

*/
quotaSetting: () => canSys(P.CHAT_USER_QUOTA_SETTING),
quotaSetting: () => canSys(P.CHAT_USER_QUOTA_SETTING) && (hasEdition(Edition.PE) || hasEdition(Edition.EE)),
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No syntax/logic error in the diff. The &&/|| precedence is correct because of the parentheses.

Review points:

  1. Import consistency

    • hasEdition is imported from '../../core', but Edition is imported from '@/permission/core/common'.
    • If Edition is already re-exported by '../../core', import both from the same barrel to avoid inconsistent module resolution and possible duplicate module instances.
    • Also check import ordering/lint rules: the @/... import is placed after relative imports.
  2. Potential circular dependency

    • Importing Edition directly from @/permission/core/common may create a circular dependency if common imports from permission/policy modules.
    • Prefer importing from the existing permission core barrel if possible.
  3. Edition gate in permission layer

    • quotaSetting now mixes system permission and edition/feature gating.
    • Confirm this is intentional. If edition gating is a product/feature rule, consider centralizing it in a helper such as canUseQuotaSetting() or isQuotaSettingEdition() instead of embedding edition logic in every permission rule.
    • Make sure the backend enforces the same edition restriction; frontend permission checks must not be the only gate.
  4. PE || EE logic

    • If hasEdition(Edition.EE) already implies all PE features, this condition may be redundant.
    • If hasEdition is an exact-match check, the current condition is fine.
    • Consider a named helper for readability, e.g.:
      const isQuotaEdition = () =>
        hasEdition(Edition.PE) || hasEdition(Edition.EE)
      
      quotaSetting: () =>
        canSys(P.CHAT_USER_QUOTA_SETTING) && isQuotaEdition(),
  5. Tests

    • Add/update tests for:
      • system permission allowed + PE edition → true
      • system permission allowed + EE edition → true
      • system permission allowed + other edition → false
      • system permission denied + PE/EE → false
    • Mock hasEdition explicitly to avoid environment-dependent tests.
  6. Runtime behavior

    • Ensure hasEdition is synchronous and safe to call during permission evaluation/menu rendering.
    • If edition/license state can change at runtime, the current function re-evaluates on each call, which is correct; just ensure callers do not cache the result incorrectly.

Overall: the change is functionally plausible, but import consistency, circular-dependency risk, and test coverage should be checked.

@peslyn
peslyn merged commit 50e824f into v3 Nov 17, 2026
3 of 4 checks passed
@peslyn
peslyn deleted the pr@v3@fix_application_chat_user_quota_setting_permission branch November 17, 2026 06:05
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