Revert "Send read reciept and typing indicator EDUs to appservices with receive_ephemeral"
This reverts commit 3675c941f8
.
This commit is contained in:
parent
9040ad054e
commit
f54a62dda0
8 changed files with 46 additions and 135 deletions
|
@ -7,11 +7,8 @@ use conduwuit::{
|
|||
};
|
||||
use futures::StreamExt;
|
||||
use ruma::{
|
||||
api::{
|
||||
appservice::event::push_events::v1::EphemeralData,
|
||||
federation::transactions::edu::{Edu, TypingContent},
|
||||
},
|
||||
events::{typing::TypingEventContent, EphemeralRoomEvent, SyncEphemeralRoomEvent},
|
||||
api::federation::transactions::edu::{Edu, TypingContent},
|
||||
events::SyncEphemeralRoomEvent,
|
||||
OwnedRoomId, OwnedUserId, RoomId, UserId,
|
||||
};
|
||||
use tokio::sync::{broadcast, RwLock};
|
||||
|
@ -79,9 +76,6 @@ impl Service {
|
|||
trace!("receiver found what it was looking for and is no longer interested");
|
||||
}
|
||||
|
||||
// update appservices
|
||||
self.appservice_send(room_id).await?;
|
||||
|
||||
// update federation
|
||||
if self.services.globals.user_is_local(user_id) {
|
||||
self.federation_send(room_id, user_id, true).await?;
|
||||
|
@ -109,8 +103,7 @@ impl Service {
|
|||
if self.typing_update_sender.send(room_id.to_owned()).is_err() {
|
||||
trace!("receiver found what it was looking for and is no longer interested");
|
||||
}
|
||||
// update appservices
|
||||
self.appservice_send(room_id).await?;
|
||||
|
||||
// update federation
|
||||
if self.services.globals.user_is_local(user_id) {
|
||||
self.federation_send(room_id, user_id, false).await?;
|
||||
|
@ -164,9 +157,6 @@ impl Service {
|
|||
trace!("receiver found what it was looking for and is no longer interested");
|
||||
}
|
||||
|
||||
// update appservices
|
||||
self.appservice_send(room_id).await?;
|
||||
|
||||
// update federation
|
||||
for user in &removable {
|
||||
if self.services.globals.user_is_local(user) {
|
||||
|
@ -190,30 +180,17 @@ impl Service {
|
|||
.unwrap_or(0))
|
||||
}
|
||||
|
||||
/// Returns a new typing EDU.
|
||||
pub async fn typings_content(&self, room_id: &RoomId) -> Result<TypingEventContent> {
|
||||
let room_typing_indicators = self.typing.read().await.get(room_id).cloned();
|
||||
|
||||
let Some(typing_indicators) = room_typing_indicators else {
|
||||
return Ok(TypingEventContent { user_ids: Vec::new() });
|
||||
};
|
||||
|
||||
let user_ids: Vec<_> = typing_indicators.into_keys().collect();
|
||||
|
||||
Ok(TypingEventContent { user_ids })
|
||||
}
|
||||
|
||||
/// Returns a new typing EDU.
|
||||
pub async fn typings_all(
|
||||
&self,
|
||||
room_id: &RoomId,
|
||||
sender_user: &UserId,
|
||||
) -> Result<SyncEphemeralRoomEvent<TypingEventContent>> {
|
||||
) -> Result<SyncEphemeralRoomEvent<ruma::events::typing::TypingEventContent>> {
|
||||
let room_typing_indicators = self.typing.read().await.get(room_id).cloned();
|
||||
|
||||
let Some(typing_indicators) = room_typing_indicators else {
|
||||
return Ok(SyncEphemeralRoomEvent {
|
||||
content: TypingEventContent { user_ids: Vec::new() },
|
||||
content: ruma::events::typing::TypingEventContent { user_ids: Vec::new() },
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -231,7 +208,9 @@ impl Service {
|
|||
.collect()
|
||||
.await;
|
||||
|
||||
Ok(SyncEphemeralRoomEvent { content: TypingEventContent { user_ids } })
|
||||
Ok(SyncEphemeralRoomEvent {
|
||||
content: ruma::events::typing::TypingEventContent { user_ids },
|
||||
})
|
||||
}
|
||||
|
||||
async fn federation_send(
|
||||
|
@ -258,21 +237,4 @@ impl Service {
|
|||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn appservice_send(&self, room_id: &RoomId) -> Result<()> {
|
||||
let edu = EphemeralData::Typing(EphemeralRoomEvent {
|
||||
content: self.typings_content(room_id).await?,
|
||||
room_id: room_id.into(),
|
||||
});
|
||||
|
||||
self.services
|
||||
.sending
|
||||
.send_edu_appservice_room(
|
||||
room_id,
|
||||
serde_json::to_vec(&edu).expect("Serialized EphemeralData::Typing"),
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue