summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-05-20 14:31:19 +0100
committerErik Johnston <erik@matrix.org>2019-05-20 14:31:19 +0100
commit1dff859d6aed58561a2b5913e5c9b897bbd3599c (patch)
treebc5a1b853370da63a0d9e090e67a3433aec0c321 /synapse
parentMerge pull request #5209 from matrix-org/erikj/reactions_base (diff)
downloadsynapse-1dff859d6aed58561a2b5913e5c9b897bbd3599c.tar.xz
Rename relation types to match MSC
Diffstat (limited to 'synapse')
-rw-r--r--synapse/api/constants.py4
-rw-r--r--synapse/events/utils.py6
-rw-r--r--synapse/storage/relations.py8
3 files changed, 9 insertions, 9 deletions
diff --git a/synapse/api/constants.py b/synapse/api/constants.py
index 28862a1d25..6b347b1749 100644
--- a/synapse/api/constants.py
+++ b/synapse/api/constants.py
@@ -125,5 +125,5 @@ class RelationTypes(object):
     """The types of relations known to this server.
     """
     ANNOTATION = "m.annotation"
-    REPLACES = "m.replaces"
-    REFERENCES = "m.references"
+    REPLACE = "m.replace"
+    REFERENCE = "m.reference"
diff --git a/synapse/events/utils.py b/synapse/events/utils.py
index bf3c8f8dc1..27a2a9ef98 100644
--- a/synapse/events/utils.py
+++ b/synapse/events/utils.py
@@ -355,7 +355,7 @@ class EventClientSerializer(object):
                 event_id,
             )
             references = yield self.store.get_relations_for_event(
-                event_id, RelationTypes.REFERENCES, direction="f",
+                event_id, RelationTypes.REFERENCE, direction="f",
             )
 
             if annotations.chunk:
@@ -364,7 +364,7 @@ class EventClientSerializer(object):
 
             if references.chunk:
                 r = serialized_event["unsigned"].setdefault("m.relations", {})
-                r[RelationTypes.REFERENCES] = references.to_dict()
+                r[RelationTypes.REFERENCE] = references.to_dict()
 
             edit = None
             if event.type == EventTypes.Message:
@@ -382,7 +382,7 @@ class EventClientSerializer(object):
                     serialized_event["content"].pop("m.relates_to", None)
 
                 r = serialized_event["unsigned"].setdefault("m.relations", {})
-                r[RelationTypes.REPLACES] = {
+                r[RelationTypes.REPLACE] = {
                     "event_id": edit.event_id,
                 }
 
diff --git a/synapse/storage/relations.py b/synapse/storage/relations.py
index 63e6185ee3..493abe405e 100644
--- a/synapse/storage/relations.py
+++ b/synapse/storage/relations.py
@@ -351,7 +351,7 @@ class RelationsWorkerStore(SQLBaseStore):
 
         def _get_applicable_edit_txn(txn):
             txn.execute(
-                sql, (event_id, RelationTypes.REPLACES,)
+                sql, (event_id, RelationTypes.REPLACE,)
             )
             row = txn.fetchone()
             if row:
@@ -384,8 +384,8 @@ class RelationsStore(RelationsWorkerStore):
         rel_type = relation.get("rel_type")
         if rel_type not in (
             RelationTypes.ANNOTATION,
-            RelationTypes.REFERENCES,
-            RelationTypes.REPLACES,
+            RelationTypes.REFERENCE,
+            RelationTypes.REPLACE,
         ):
             # Unknown relation type
             return
@@ -413,7 +413,7 @@ class RelationsStore(RelationsWorkerStore):
             self.get_aggregation_groups_for_event.invalidate_many, (parent_id,)
         )
 
-        if rel_type == RelationTypes.REPLACES:
+        if rel_type == RelationTypes.REPLACE:
             txn.call_after(self.get_applicable_edit.invalidate, (parent_id,))
 
     def _handle_redaction(self, txn, redacted_event_id):