fix: set limited to true when skipping messages in /sync
This commit is contained in:
parent
e457e19088
commit
f23fb32e95
5 changed files with 24 additions and 10 deletions
|
@ -60,10 +60,10 @@ pub fn search_events_route(
|
|||
Ok::<_, Error>(SearchResult {
|
||||
context: None,
|
||||
rank: None,
|
||||
result: dbg!(db
|
||||
result: db
|
||||
.rooms
|
||||
.get_pdu_from_id(dbg!(&result))?
|
||||
.map(|pdu| pdu.to_room_event())),
|
||||
.get_pdu_from_id(&result)?
|
||||
.map(|pdu| pdu.to_room_event()),
|
||||
})
|
||||
})
|
||||
.filter_map(|r| r.ok())
|
||||
|
|
|
@ -69,13 +69,14 @@ pub async fn sync_events_route(
|
|||
|
||||
// They /sync response doesn't always return all messages, so we say the output is
|
||||
// limited unless there are events in non_timeline_pdus
|
||||
//let mut limited = false;
|
||||
let mut limited = false;
|
||||
|
||||
let mut state_pdus = Vec::new();
|
||||
for pdu in non_timeline_pdus {
|
||||
if pdu.state_key.is_some() {
|
||||
state_pdus.push(pdu);
|
||||
}
|
||||
limited = true;
|
||||
}
|
||||
|
||||
let mut send_member_count = false;
|
||||
|
@ -271,7 +272,7 @@ pub async fn sync_events_route(
|
|||
notification_count,
|
||||
},
|
||||
timeline: sync_events::Timeline {
|
||||
limited: joined_since_last_sync,
|
||||
limited: limited || joined_since_last_sync,
|
||||
prev_batch,
|
||||
events: room_events,
|
||||
},
|
||||
|
|
|
@ -575,7 +575,7 @@ impl Rooms {
|
|||
self.roomstateid_pdu.insert(key, &*pdu_json.to_string())?;
|
||||
}
|
||||
|
||||
match dbg!(event_type) {
|
||||
match event_type {
|
||||
EventType::RoomRedaction => {
|
||||
if let Some(redact_id) = &redacts {
|
||||
// TODO: Reason
|
||||
|
@ -619,7 +619,7 @@ impl Rooms {
|
|||
}
|
||||
}
|
||||
EventType::RoomMessage => {
|
||||
if let Some(body) = dbg!(content).get("body").and_then(|b| b.as_str()) {
|
||||
if let Some(body) = content.get("body").and_then(|b| b.as_str()) {
|
||||
for word in body
|
||||
.split_terminator(|c: char| !c.is_alphanumeric())
|
||||
.map(str::to_lowercase)
|
||||
|
@ -1002,7 +1002,7 @@ impl Rooms {
|
|||
.iter_mut()
|
||||
.map(|it| {
|
||||
while let Some(element) = it.peek() {
|
||||
if dbg!(element) > dbg!(target) {
|
||||
if element > target {
|
||||
return false;
|
||||
} else if element == target {
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue