Ver código fonte

Prefer the stable identifier for MSC3288. (#437)

If the stable identifier is unavailable, fallback to the unstable
identifier for `room_type`.
Patrick Cloke 2 anos atrás
pai
commit
82842bff09

+ 1 - 0
changelog.d/437.feature

@@ -0,0 +1 @@
+Support the stable room type field for [MSC3288](https://github.com/matrix-org/matrix-doc/pull/3288).

+ 6 - 4
sydent/http/servlets/store_invite_servlet.py

@@ -125,10 +125,12 @@ class StoreInviteServlet(Resource):
         for k in extra_substitutions:
             substitutions.setdefault(k, "")
 
-        # MSC3288
-        substitutions["room_type"] = substitutions.get(
-            "org.matrix.msc3288.room_type", ""
-        )
+        # For MSC3288 room type, prefer the stable field, but fallback to the
+        # unstable field.
+        if "room_type" not in substitutions:
+            substitutions["room_type"] = substitutions.get(
+                "org.matrix.msc3288.room_type", ""
+            )
 
         substitutions["bracketed_verified_sender"] = ""
         if verified_sender: