mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-16 04:43:50 +01:00
Avoid relying on int vs None comparison
Python 3 doesn't support comparing None to ints
This commit is contained in:
parent
cbf82dddf1
commit
2c33b55738
1 changed files with 5 additions and 1 deletions
|
@ -525,7 +525,11 @@ def _check_power_levels(event, auth_events):
|
||||||
"to your own"
|
"to your own"
|
||||||
)
|
)
|
||||||
|
|
||||||
if old_level > user_level or new_level > user_level:
|
# Check if the old and new levels are greater than the user level
|
||||||
|
# (if defined)
|
||||||
|
old_level_too_big = old_level is not None and old_level > user_level
|
||||||
|
new_level_too_big = new_level is not None and new_level > user_level
|
||||||
|
if old_level_too_big or new_level_too_big:
|
||||||
raise AuthError(
|
raise AuthError(
|
||||||
403,
|
403,
|
||||||
"You don't have permission to add ops level greater "
|
"You don't have permission to add ops level greater "
|
||||||
|
|
Loading…
Reference in a new issue