mirror of
https://gitlab.com/famedly/conduit.git
synced 2024-11-14 21:21:05 +01:00
fix: /context for element android. start and end must be set even with limit=0
This commit is contained in:
parent
15cc801840
commit
49a0f3a60d
4 changed files with 17 additions and 13 deletions
|
@ -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
|
let events_before: Vec<_> = events_before
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
@ -156,7 +159,10 @@ pub async fn get_context_route(
|
||||||
.state_full_ids(shortstatehash)
|
.state_full_ids(shortstatehash)
|
||||||
.await?;
|
.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
|
let events_after: Vec<_> = events_after
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
@ -193,8 +199,8 @@ pub async fn get_context_route(
|
||||||
}
|
}
|
||||||
|
|
||||||
let resp = get_context::v3::Response {
|
let resp = get_context::v3::Response {
|
||||||
start: start_token,
|
start: Some(start_token),
|
||||||
end: end_token,
|
end: Some(end_token),
|
||||||
events_before,
|
events_before,
|
||||||
event: Some(base_event),
|
event: Some(base_event),
|
||||||
events_after,
|
events_after,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#[allow(deprecated)]
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
api::client_server::{self, claim_keys_helper, get_keys_helper},
|
api::client_server::{self, claim_keys_helper, get_keys_helper},
|
||||||
service::pdu::{gen_event_id_canonical_json, PduBuilder},
|
service::pdu::{gen_event_id_canonical_json, PduBuilder},
|
||||||
|
|
|
@ -1,18 +1,15 @@
|
||||||
mod data;
|
mod data;
|
||||||
use std::sync::Arc;
|
|
||||||
|
|
||||||
pub use data::Data;
|
pub use data::Data;
|
||||||
use ruma::{
|
use ruma::{
|
||||||
api::client::{error::ErrorKind, threads::get_threads::v1::IncludeThreads},
|
api::client::{error::ErrorKind, threads::get_threads::v1::IncludeThreads},
|
||||||
events::{relation::BundledThread, StateEventType},
|
events::relation::BundledThread,
|
||||||
uint, CanonicalJsonValue, EventId, OwnedUserId, RoomId, UserId,
|
uint, CanonicalJsonValue, EventId, RoomId, UserId,
|
||||||
};
|
};
|
||||||
use serde::Deserialize;
|
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
|
|
||||||
use crate::{services, utils, Error, PduEvent, Result};
|
use crate::{services, Error, PduEvent, Result};
|
||||||
|
|
||||||
use super::timeline::PduCount;
|
|
||||||
|
|
||||||
pub struct Service {
|
pub struct Service {
|
||||||
pub db: &'static dyn Data,
|
pub db: &'static dyn Data,
|
||||||
|
|
|
@ -24,7 +24,7 @@ use ruma::{
|
||||||
GlobalAccountDataEventType, StateEventType, TimelineEventType,
|
GlobalAccountDataEventType, StateEventType, TimelineEventType,
|
||||||
},
|
},
|
||||||
push::{Action, Ruleset, Tweak},
|
push::{Action, Ruleset, Tweak},
|
||||||
serde::{Base64, JsonObject},
|
serde::Base64,
|
||||||
state_res,
|
state_res,
|
||||||
state_res::{Event, RoomVersion},
|
state_res::{Event, RoomVersion},
|
||||||
uint, user_id, CanonicalJsonObject, CanonicalJsonValue, EventId, OwnedEventId, OwnedRoomId,
|
uint, user_id, CanonicalJsonObject, CanonicalJsonValue, EventId, OwnedEventId, OwnedRoomId,
|
||||||
|
|
Loading…
Reference in a new issue