Send read reciept and typing indicator EDUs to appservices with receive_ephemeral

This commit is contained in:
Jade Ellis 2024-12-18 03:04:39 +00:00 committed by strawberry
commit 3675c941f8
8 changed files with 135 additions and 46 deletions

View file

@ -1,3 +1,4 @@
use core::str;
use std::{
collections::{BTreeMap, HashMap, HashSet},
fmt::Debug,
@ -21,7 +22,7 @@ use futures::{
};
use ruma::{
api::{
appservice::event::push_events::v1::Edu as RumaEdu,
appservice::event::push_events::v1::EphemeralData,
federation::transactions::{
edu::{
DeviceListUpdateContent, Edu, PresenceContent, PresenceUpdate, ReceiptContent,
@ -587,7 +588,7 @@ impl Service {
.filter(|event| matches!(event, SendingEvent::Pdu(_)))
.count(),
);
let mut edu_jsons: Vec<RumaEdu> = Vec::with_capacity(
let mut edu_jsons: Vec<EphemeralData> = Vec::with_capacity(
events
.iter()
.filter(|event| matches!(event, SendingEvent::Edu(_)))
@ -600,16 +601,12 @@ impl Service {
pdu_jsons.push(pdu.to_room_event());
}
},
| SendingEvent::Edu(edu) => {
if appservice
.receive_ephemeral
.is_some_and(|receive_edus| receive_edus)
{
| SendingEvent::Edu(edu) =>
if appservice.receive_ephemeral {
if let Ok(edu) = serde_json::from_slice(edu) {
edu_jsons.push(edu);
}
}
},
},
| SendingEvent::Flush => {}, // flush only; no new content
}
}