Skip to content

Add pre-defined check can_redact - #121

Open
AnayGarodia wants to merge 1 commit into
Code-Society-Lab:mainfrom
AnayGarodia:feat/can-redact-check
Open

Add pre-defined check can_redact#121
AnayGarodia wants to merge 1 commit into
Code-Society-Lab:mainfrom
AnayGarodia:feat/can-redact-check

Conversation

@AnayGarodia

Copy link
Copy Markdown
Contributor

Description

Adds the pre-defined check can_redact to matrix/checks.py, following the same decorator pattern as is_admin/is_moderator. The check uses PowerLevels.can_user_redact to compare the sender's power level against the room's redact power level, so commands decorated with it raise CheckError when the sender is not allowed to redact other users' events. Includes unit tests mirroring the existing check tests, including one against a custom room redact level.

Closes #107

Type of Change

  • Feature
  • Refactor
  • Bug fix
  • Documentation
  • Other: ___

Pre-merge Checklist

  • Run tests: pytest (384 passed)
  • Run type check: mypy
  • Run formatting: black .

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019cFhMyHwVAQ9GieYbi3aUb
Copilot AI review requested due to automatic review settings July 29, 2026 19:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

Check: can_redact

2 participants