mirror of
https://github.com/girlbossceo/conduwuit.git
synced 2024-11-28 05:45:48 +00:00
use body.dir for relations now
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
92dbe82675
commit
fa71dd4b4c
|
@ -12,8 +12,7 @@ pub async fn get_relating_events_with_rel_type_and_event_type_route(
|
|||
|
||||
let from = match body.from.clone() {
|
||||
Some(from) => PduCount::try_from_string(&from)?,
|
||||
None => match ruma::api::Direction::Backward {
|
||||
// TODO: fix ruma so `body.dir` exists
|
||||
None => match body.dir {
|
||||
ruma::api::Direction::Forward => PduCount::min(),
|
||||
ruma::api::Direction::Backward => PduCount::max(),
|
||||
},
|
||||
|
@ -41,6 +40,7 @@ pub async fn get_relating_events_with_rel_type_and_event_type_route(
|
|||
&Some(body.event_type.clone()),
|
||||
&Some(body.rel_type.clone()),
|
||||
from,
|
||||
body.dir,
|
||||
to,
|
||||
limit,
|
||||
)?;
|
||||
|
@ -61,8 +61,7 @@ pub async fn get_relating_events_with_rel_type_route(
|
|||
|
||||
let from = match body.from.clone() {
|
||||
Some(from) => PduCount::try_from_string(&from)?,
|
||||
None => match ruma::api::Direction::Backward {
|
||||
// TODO: fix ruma so `body.dir` exists
|
||||
None => match body.dir {
|
||||
ruma::api::Direction::Forward => PduCount::min(),
|
||||
ruma::api::Direction::Backward => PduCount::max(),
|
||||
},
|
||||
|
@ -90,6 +89,7 @@ pub async fn get_relating_events_with_rel_type_route(
|
|||
&None,
|
||||
&Some(body.rel_type.clone()),
|
||||
from,
|
||||
body.dir,
|
||||
to,
|
||||
limit,
|
||||
)?;
|
||||
|
@ -110,8 +110,7 @@ pub async fn get_relating_events_route(
|
|||
|
||||
let from = match body.from.clone() {
|
||||
Some(from) => PduCount::try_from_string(&from)?,
|
||||
None => match ruma::api::Direction::Backward {
|
||||
// TODO: fix ruma so `body.dir` exists
|
||||
None => match body.dir {
|
||||
ruma::api::Direction::Forward => PduCount::min(),
|
||||
ruma::api::Direction::Backward => PduCount::max(),
|
||||
},
|
||||
|
@ -132,5 +131,15 @@ pub async fn get_relating_events_route(
|
|||
services()
|
||||
.rooms
|
||||
.pdu_metadata
|
||||
.paginate_relations_with_filter(sender_user, &body.room_id, &body.event_id, &None, &None, from, to, limit)
|
||||
.paginate_relations_with_filter(
|
||||
sender_user,
|
||||
&body.room_id,
|
||||
&body.event_id,
|
||||
&None,
|
||||
&None,
|
||||
from,
|
||||
body.dir,
|
||||
to,
|
||||
limit,
|
||||
)
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ use std::sync::Arc;
|
|||
|
||||
pub use data::Data;
|
||||
use ruma::{
|
||||
api::client::relations::get_relating_events,
|
||||
api::{client::relations::get_relating_events, Direction},
|
||||
events::{relation::RelationType, TimelineEventType},
|
||||
EventId, RoomId, UserId,
|
||||
};
|
||||
|
@ -42,13 +42,12 @@ impl Service {
|
|||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn paginate_relations_with_filter(
|
||||
&self, sender_user: &UserId, room_id: &RoomId, target: &EventId, filter_event_type: &Option<TimelineEventType>,
|
||||
filter_rel_type: &Option<RelationType>, from: PduCount, to: Option<PduCount>, limit: usize,
|
||||
filter_rel_type: &Option<RelationType>, from: PduCount, dir: Direction, to: Option<PduCount>, limit: usize,
|
||||
) -> Result<get_relating_events::v1::Response> {
|
||||
let next_token;
|
||||
|
||||
//TODO: Fix ruma: match body.dir {
|
||||
match ruma::api::Direction::Backward {
|
||||
ruma::api::Direction::Forward => {
|
||||
match dir {
|
||||
Direction::Forward => {
|
||||
let events_after: Vec<_> = services()
|
||||
.rooms
|
||||
.pdu_metadata
|
||||
|
@ -94,7 +93,7 @@ impl Service {
|
|||
recursion_depth: None, // TODO
|
||||
})
|
||||
},
|
||||
ruma::api::Direction::Backward => {
|
||||
Direction::Backward => {
|
||||
let events_before: Vec<_> = services()
|
||||
.rooms
|
||||
.pdu_metadata
|
||||
|
|
Loading…
Reference in a new issue