mirror of
https://gitlab.com/famedly/conduit.git
synced 2024-11-14 13:11:04 +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
|
||||
.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,
|
||||
|
|
|
@ -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},
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue