mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-11 11:24:21 -05:00
Fix bug where we didn't correctly store the ops power levels event.
This commit is contained in:
parent
4ac80b8570
commit
4b8244fbf8
@ -169,6 +169,11 @@ class Auth(object):
|
|||||||
)
|
)
|
||||||
_, kick_level = yield self.store.get_ops_levels(event.room_id)
|
_, kick_level = yield self.store.get_ops_levels(event.room_id)
|
||||||
|
|
||||||
|
if kick_level:
|
||||||
|
kick_level = int(kick_level)
|
||||||
|
else:
|
||||||
|
kick_level = 5
|
||||||
|
|
||||||
if user_level < kick_level:
|
if user_level < kick_level:
|
||||||
raise AuthError(
|
raise AuthError(
|
||||||
403, "You cannot kick user %s." % target_user_id
|
403, "You cannot kick user %s." % target_user_id
|
||||||
|
@ -23,6 +23,7 @@ from synapse.api.events.room import (
|
|||||||
RoomPowerLevelsEvent,
|
RoomPowerLevelsEvent,
|
||||||
RoomAddStateLevelEvent,
|
RoomAddStateLevelEvent,
|
||||||
RoomSendEventLevelEvent,
|
RoomSendEventLevelEvent,
|
||||||
|
RoomOpsPowerLevelsEvent,
|
||||||
)
|
)
|
||||||
|
|
||||||
from synapse.util.logutils import log_function
|
from synapse.util.logutils import log_function
|
||||||
@ -140,6 +141,8 @@ class DataStore(RoomMemberStore, RoomStore,
|
|||||||
self._store_add_state_level(txn, event)
|
self._store_add_state_level(txn, event)
|
||||||
elif event.type == RoomSendEventLevelEvent.TYPE:
|
elif event.type == RoomSendEventLevelEvent.TYPE:
|
||||||
self._store_send_event_level(txn, event)
|
self._store_send_event_level(txn, event)
|
||||||
|
elif event.type == RoomOpsPowerLevelsEvent.TYPE:
|
||||||
|
self._store_ops_level(txn, event)
|
||||||
|
|
||||||
vals = {
|
vals = {
|
||||||
"topological_ordering": event.depth,
|
"topological_ordering": event.depth,
|
||||||
|
@ -328,7 +328,7 @@ class RoomStore(SQLBaseStore):
|
|||||||
|
|
||||||
self._simple_insert_txn(
|
self._simple_insert_txn(
|
||||||
txn,
|
txn,
|
||||||
"room_send_event_levels",
|
"room_ops_levels",
|
||||||
content,
|
content,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user