default to main event for batch tokens
fix prev_batch token for legacy sync timeline Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
c519a40cb8
commit
97ad9afc86
3 changed files with 3 additions and 4 deletions
|
@ -169,12 +169,14 @@ pub(crate) async fn get_context_route(
|
||||||
start: events_before
|
start: events_before
|
||||||
.last()
|
.last()
|
||||||
.map(at!(0))
|
.map(at!(0))
|
||||||
|
.or(Some(base_token))
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(ToString::to_string),
|
.map(ToString::to_string),
|
||||||
|
|
||||||
end: events_after
|
end: events_after
|
||||||
.last()
|
.last()
|
||||||
.map(at!(0))
|
.map(at!(0))
|
||||||
|
.or(Some(base_token))
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(ToString::to_string),
|
.map(ToString::to_string),
|
||||||
|
|
||||||
|
|
|
@ -136,8 +136,6 @@ pub(crate) async fn get_message_events_route(
|
||||||
.collect()
|
.collect()
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
let start_token = events.first().map(at!(0)).unwrap_or(from);
|
|
||||||
|
|
||||||
let next_token = events.last().map(at!(0));
|
let next_token = events.last().map(at!(0));
|
||||||
|
|
||||||
if !cfg!(feature = "element_hacks") {
|
if !cfg!(feature = "element_hacks") {
|
||||||
|
@ -156,7 +154,7 @@ pub(crate) async fn get_message_events_route(
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
Ok(get_message_events::v3::Response {
|
Ok(get_message_events::v3::Response {
|
||||||
start: start_token.to_string(),
|
start: from.to_string(),
|
||||||
end: next_token.as_ref().map(ToString::to_string),
|
end: next_token.as_ref().map(ToString::to_string),
|
||||||
chunk,
|
chunk,
|
||||||
state,
|
state,
|
||||||
|
|
|
@ -945,7 +945,6 @@ async fn load_joined_room(
|
||||||
let prev_batch = timeline_pdus
|
let prev_batch = timeline_pdus
|
||||||
.first()
|
.first()
|
||||||
.map(at!(0))
|
.map(at!(0))
|
||||||
.map(|count| count.saturating_sub(1))
|
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(ToString::to_string);
|
.map(ToString::to_string);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue