accept receipts prior to events
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
7d2f510cc3
commit
c2586737ae
2 changed files with 4 additions and 20 deletions
|
@ -7,7 +7,7 @@ extern crate conduit_core as conduit;
|
|||
extern crate conduit_service as service;
|
||||
|
||||
pub use client_server::membership::{join_room_by_id_helper, leave_all_rooms};
|
||||
pub(crate) use conduit::{debug_error, debug_info, debug_warn, utils, Error, Result};
|
||||
pub(crate) use conduit::{debug_info, debug_warn, utils, Error, Result};
|
||||
pub(crate) use ruma_wrapper::{Ruma, RumaResponse};
|
||||
pub(crate) use service::{pdu::PduEvent, services, user_is_local};
|
||||
|
||||
|
|
|
@ -54,7 +54,6 @@ use tracing::{debug, error, trace, warn};
|
|||
|
||||
use crate::{
|
||||
client_server::{self, claim_keys_helper, get_keys_helper},
|
||||
debug_error,
|
||||
service::{
|
||||
pdu::{gen_event_id_canonical_json, PduBuilder},
|
||||
rooms::event_handler::parse_incoming_pdu,
|
||||
|
@ -369,22 +368,9 @@ pub(crate) async fn send_transaction_message_route(
|
|||
}
|
||||
|
||||
if services().rooms.state_cache.is_joined(&user_id, &room_id)? {
|
||||
if let Some((event_id, _)) = user_updates
|
||||
.event_ids
|
||||
.iter()
|
||||
.filter_map(|id| {
|
||||
services()
|
||||
.rooms
|
||||
.timeline
|
||||
.get_pdu_count(id)
|
||||
.ok()
|
||||
.flatten()
|
||||
.map(|r| (id, r))
|
||||
})
|
||||
.max_by_key(|(_, count)| *count)
|
||||
{
|
||||
for event_id in &user_updates.event_ids {
|
||||
let mut user_receipts = BTreeMap::new();
|
||||
user_receipts.insert(user_id.clone(), user_updates.data);
|
||||
user_receipts.insert(user_id.clone(), user_updates.data.clone());
|
||||
|
||||
let mut receipts = BTreeMap::new();
|
||||
receipts.insert(ReceiptType::Read, user_receipts);
|
||||
|
@ -396,13 +382,11 @@ pub(crate) async fn send_transaction_message_route(
|
|||
content: ReceiptEventContent(receipt_content),
|
||||
room_id: room_id.clone(),
|
||||
};
|
||||
|
||||
services()
|
||||
.rooms
|
||||
.read_receipt
|
||||
.readreceipt_update(&user_id, &room_id, event)?;
|
||||
} else {
|
||||
// TODO fetch missing events
|
||||
debug_error!("No known event ids in read receipt: {:?}", user_updates);
|
||||
}
|
||||
} else {
|
||||
debug_warn!(%user_id, %room_id, "received read receipt EDU for user not in room");
|
||||
|
|
Loading…
Add table
Reference in a new issue