move typing feature up one level out of rooms.edus.

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-03-31 17:14:31 -07:00 committed by June
parent 89a919ce75
commit 9790477b0e
8 changed files with 10 additions and 20 deletions

View file

@ -1003,16 +1003,10 @@ async fn load_joined_room(
.map(|(_, _, v)| v)
.collect();
if services()
.rooms
.edus
.typing
.last_typing_update(room_id)
.await? > since
{
if services().rooms.typing.last_typing_update(room_id).await? > since {
edus.push(
serde_json::from_str(
&serde_json::to_string(&services().rooms.edus.typing.typings_all(room_id).await?)
&serde_json::to_string(&services().rooms.typing.typings_all(room_id).await?)
.expect("event is valid, we just created it"),
)
.expect("event is valid, we just created it"),

View file

@ -28,14 +28,12 @@ pub async fn create_typing_event_route(
);
services()
.rooms
.edus
.typing
.typing_add(sender_user, &body.room_id, utils::millis_since_unix_epoch() + duration)
.await?;
} else {
services()
.rooms
.edus
.typing
.typing_remove(sender_user, &body.room_id)
.await?;

View file

@ -410,14 +410,12 @@ pub async fn send_transaction_message_route(
+ services().globals.config.typing_federation_timeout_s * 1000;
services()
.rooms
.edus
.typing
.typing_add(&typing.user_id, &typing.room_id, timeout)
.await?;
} else {
services()
.rooms
.edus
.typing
.typing_remove(&typing.user_id, &typing.room_id)
.await?;