Allow sending custom data in /read_markers too

This commit is contained in:
Tulir Asokan 2021-12-21 17:53:01 +02:00
parent 360f254c6d
commit 9c9cdae578
2 changed files with 8 additions and 3 deletions

View file

@ -13,9 +13,10 @@
# limitations under the License.
import logging
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Optional
from synapse.util.async_helpers import Linearizer
from synapse.types import JsonDict
if TYPE_CHECKING:
from synapse.server import HomeServer
@ -31,7 +32,7 @@ class ReadMarkerHandler:
self.read_marker_linearizer = Linearizer(name="read_marker")
async def received_client_read_marker(
self, room_id: str, user_id: str, event_id: str
self, room_id: str, user_id: str, event_id: str, extra_content: Optional[JsonDict] = None
) -> None:
"""Updates the read marker for a given user in a given room if the event ID given
is ahead in the stream relative to the current read marker.
@ -54,7 +55,7 @@ class ReadMarkerHandler:
)
if should_update:
content = {"event_id": event_id}
content = {"event_id": event_id, **(extra_content or {})}
await self.account_data_handler.add_account_data_to_room(
user_id, room_id, "m.fully_read", content
)