diff options
Diffstat (limited to 'synapse/api')
-rw-r--r-- | synapse/api/auth.py | 18 | ||||
-rw-r--r-- | synapse/api/events/__init__.py | 4 | ||||
-rw-r--r-- | synapse/api/events/factory.py | 4 | ||||
-rw-r--r-- | synapse/api/events/room.py | 6 | ||||
-rw-r--r-- | synapse/api/events/utils.py | 4 |
5 files changed, 18 insertions, 18 deletions
diff --git a/synapse/api/auth.py b/synapse/api/auth.py index fb14d9a2b3..9c65d47fb4 100644 --- a/synapse/api/auth.py +++ b/synapse/api/auth.py @@ -20,7 +20,7 @@ from twisted.internet import defer from synapse.api.constants import Membership, JoinRules from synapse.api.errors import AuthError, StoreError, Codes, SynapseError from synapse.api.events.room import ( - RoomMemberEvent, RoomPowerLevelsEvent, RoomDeletionEvent, + RoomMemberEvent, RoomPowerLevelsEvent, RoomRedactionEvent, ) from synapse.util.logutils import log_function @@ -72,8 +72,8 @@ class Auth(object): if event.type == RoomPowerLevelsEvent.TYPE: yield self._check_power_levels(event) - if event.type == RoomDeletionEvent.TYPE: - yield self._check_deletion(event) + if event.type == RoomRedactionEvent.TYPE: + yield self._check_redaction(event) defer.returnValue(True) else: @@ -327,7 +327,7 @@ class Auth(object): ) @defer.inlineCallbacks - def _check_deletion(self, event): + def _check_redaction(self, event): user_level = yield self.store.get_power_level( event.room_id, event.user_id, @@ -338,15 +338,15 @@ class Auth(object): else: user_level = 0 - _, _, delete_level = yield self.store.get_ops_levels(event.room_id) + _, _, redact_level = yield self.store.get_ops_levels(event.room_id) - if not delete_level: - delete_level = 50 + if not redact_level: + redact_level = 50 - if user_level < delete_level: + if user_level < redact_level: raise AuthError( 403, - "You don't have permission to delete events" + "You don't have permission to redact events" ) @defer.inlineCallbacks diff --git a/synapse/api/events/__init__.py b/synapse/api/events/__init__.py index d68629209d..0ceb703c74 100644 --- a/synapse/api/events/__init__.py +++ b/synapse/api/events/__init__.py @@ -59,7 +59,7 @@ class SynapseEvent(JsonEncodedObject): "age_ts", "prev_content", "prev_state", - "pruned_because", + "redacted_because", ] internal_keys = [ @@ -70,7 +70,7 @@ class SynapseEvent(JsonEncodedObject): "origin", "outlier", "power_level", - "deleted", + "redacted", ] required_keys = [ diff --git a/synapse/api/events/factory.py b/synapse/api/events/factory.py index c65ea8372b..0d94850cec 100644 --- a/synapse/api/events/factory.py +++ b/synapse/api/events/factory.py @@ -18,7 +18,7 @@ from synapse.api.events.room import ( InviteJoinEvent, RoomConfigEvent, RoomNameEvent, GenericEvent, RoomPowerLevelsEvent, RoomJoinRulesEvent, RoomOpsPowerLevelsEvent, RoomCreateEvent, RoomAddStateLevelEvent, RoomSendEventLevelEvent, - RoomDeletionEvent, + RoomRedactionEvent, ) from synapse.util.stringutils import random_string @@ -40,7 +40,7 @@ class EventFactory(object): RoomAddStateLevelEvent, RoomSendEventLevelEvent, RoomOpsPowerLevelsEvent, - RoomDeletionEvent, + RoomRedactionEvent, ] def __init__(self, hs): diff --git a/synapse/api/events/room.py b/synapse/api/events/room.py index 9861395556..cd936074fc 100644 --- a/synapse/api/events/room.py +++ b/synapse/api/events/room.py @@ -182,10 +182,10 @@ class RoomAliasesEvent(SynapseStateEvent): return {} -class RoomDeletionEvent(SynapseEvent): - TYPE = "m.room.deletion" +class RoomRedactionEvent(SynapseEvent): + TYPE = "m.room.redaction" - valid_keys = SynapseEvent.valid_keys + ["deletes"] + valid_keys = SynapseEvent.valid_keys + ["redacts"] def get_content_template(self): return {} diff --git a/synapse/api/events/utils.py b/synapse/api/events/utils.py index 3d8b9a1db1..c3a32be8c1 100644 --- a/synapse/api/events/utils.py +++ b/synapse/api/events/utils.py @@ -23,7 +23,7 @@ def prune_event(event): """ Prunes the given event of all keys we don't know about or think could potentially be dodgy. - This is used when we "delete" an event. We want to remove all fields that + This is used when we "redact" an event. We want to remove all fields that the user has specified, but we do want to keep necessary information like type, state_key etc. """ @@ -55,7 +55,7 @@ def prune_event(event): elif event.type == RoomSendEventLevelEvent.TYPE: add_fields("level") elif event.type == RoomOpsPowerLevelsEvent.TYPE: - add_fields("kick_level", "ban_level", "delete_level") + add_fields("kick_level", "ban_level", "redact_level") elif event.type == RoomAliasesEvent.TYPE: add_fields("aliases") |