Merge branch 'contextfix' into 'next'

fix: /context for element android. start and end must be set even with limit=0

See merge request famedly/conduit!485
This commit is contained in:
Timo Kösters 2023-06-26 06:34:10 +00:00
commit caa841c434
4 changed files with 17 additions and 13 deletions

View File

@ -103,7 +103,10 @@ pub async fn get_context_route(
}
}
let start_token = events_before.last().map(|(count, _)| count.stringify());
let start_token = events_before
.last()
.map(|(count, _)| count.stringify())
.unwrap_or_else(|| base_token.stringify());
let events_before: Vec<_> = events_before
.into_iter()
@ -156,7 +159,10 @@ pub async fn get_context_route(
.state_full_ids(shortstatehash)
.await?;
let end_token = events_after.last().map(|(count, _)| count.stringify());
let end_token = events_after
.last()
.map(|(count, _)| count.stringify())
.unwrap_or_else(|| base_token.stringify());
let events_after: Vec<_> = events_after
.into_iter()
@ -193,8 +199,8 @@ pub async fn get_context_route(
}
let resp = get_context::v3::Response {
start: start_token,
end: end_token,
start: Some(start_token),
end: Some(end_token),
events_before,
event: Some(base_event),
events_after,

View File

@ -1,4 +1,5 @@
#[allow(deprecated)]
#![allow(deprecated)]
use crate::{
api::client_server::{self, claim_keys_helper, get_keys_helper},
service::pdu::{gen_event_id_canonical_json, PduBuilder},

View File

@ -1,18 +1,15 @@
mod data;
use std::sync::Arc;
pub use data::Data;
use ruma::{
api::client::{error::ErrorKind, threads::get_threads::v1::IncludeThreads},
events::{relation::BundledThread, StateEventType},
uint, CanonicalJsonValue, EventId, OwnedUserId, RoomId, UserId,
events::relation::BundledThread,
uint, CanonicalJsonValue, EventId, RoomId, UserId,
};
use serde::Deserialize;
use serde_json::json;
use crate::{services, utils, Error, PduEvent, Result};
use super::timeline::PduCount;
use crate::{services, Error, PduEvent, Result};
pub struct Service {
pub db: &'static dyn Data,

View File

@ -24,7 +24,7 @@ use ruma::{
GlobalAccountDataEventType, StateEventType, TimelineEventType,
},
push::{Action, Ruleset, Tweak},
serde::{Base64, JsonObject},
serde::Base64,
state_res,
state_res::{Event, RoomVersion},
uint, user_id, CanonicalJsonObject, CanonicalJsonValue, EventId, OwnedEventId, OwnedRoomId,