mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-12-26 00:19:26 -05:00
Move MSC2654 support behind an experimental configuration flag. (#12295)
To match the current thinking on disabling experimental features by default.
This commit is contained in:
parent
6927d87254
commit
bebf994ee8
1
changelog.d/12295.misc
Normal file
1
changelog.d/12295.misc
Normal file
@ -0,0 +1 @@
|
|||||||
|
Move [MSC2654](https://github.com/matrix-org/matrix-doc/pull/2654) support behind an experimental configuration flag.
|
@ -78,3 +78,6 @@ class ExperimentalConfig(Config):
|
|||||||
|
|
||||||
# The deprecated groups feature.
|
# The deprecated groups feature.
|
||||||
self.groups_enabled: bool = experimental.get("groups_enabled", True)
|
self.groups_enabled: bool = experimental.get("groups_enabled", True)
|
||||||
|
|
||||||
|
# MSC2654: Unread counts
|
||||||
|
self.msc2654_enabled: bool = experimental.get("msc2654_enabled", False)
|
||||||
|
@ -99,6 +99,7 @@ class SyncRestServlet(RestServlet):
|
|||||||
self.presence_handler = hs.get_presence_handler()
|
self.presence_handler = hs.get_presence_handler()
|
||||||
self._server_notices_sender = hs.get_server_notices_sender()
|
self._server_notices_sender = hs.get_server_notices_sender()
|
||||||
self._event_serializer = hs.get_event_client_serializer()
|
self._event_serializer = hs.get_event_client_serializer()
|
||||||
|
self._msc2654_enabled = hs.config.experimental.msc2654_enabled
|
||||||
|
|
||||||
async def on_GET(self, request: SynapseRequest) -> Tuple[int, JsonDict]:
|
async def on_GET(self, request: SynapseRequest) -> Tuple[int, JsonDict]:
|
||||||
# This will always be set by the time Twisted calls us.
|
# This will always be set by the time Twisted calls us.
|
||||||
@ -521,6 +522,7 @@ class SyncRestServlet(RestServlet):
|
|||||||
result["ephemeral"] = {"events": ephemeral_events}
|
result["ephemeral"] = {"events": ephemeral_events}
|
||||||
result["unread_notifications"] = room.unread_notifications
|
result["unread_notifications"] = room.unread_notifications
|
||||||
result["summary"] = room.summary
|
result["summary"] = room.summary
|
||||||
|
if self._msc2654_enabled:
|
||||||
result["org.matrix.msc2654.unread_count"] = room.unread_count
|
result["org.matrix.msc2654.unread_count"] = room.unread_count
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
@ -496,6 +496,11 @@ class UnreadMessagesTestCase(unittest.HomeserverTestCase):
|
|||||||
receipts.register_servlets,
|
receipts.register_servlets,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
def default_config(self) -> JsonDict:
|
||||||
|
config = super().default_config()
|
||||||
|
config["experimental_features"] = {"msc2654_enabled": True}
|
||||||
|
return config
|
||||||
|
|
||||||
def prepare(self, reactor: MemoryReactor, clock: Clock, hs: HomeServer) -> None:
|
def prepare(self, reactor: MemoryReactor, clock: Clock, hs: HomeServer) -> None:
|
||||||
self.url = "/sync?since=%s"
|
self.url = "/sync?since=%s"
|
||||||
self.next_batch = "s0"
|
self.next_batch = "s0"
|
||||||
|
Loading…
Reference in New Issue
Block a user