Skip to content

Commit

Permalink
Merge branch 'main' into env
Browse files Browse the repository at this point in the history
  • Loading branch information
avdb13 authored Feb 23, 2024
2 parents 8dc7bc3 + 8891d61 commit 4252307
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 45 deletions.
1 change: 0 additions & 1 deletion crates/matrix/src/admin/resources/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
pub mod room;
pub mod token;
pub mod user;
pub mod user_id;
3 changes: 2 additions & 1 deletion crates/matrix/src/admin/resources/room.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ pub struct ListRoomQuery {
pub search_term: String,
}

#[derive(Debug, Serialize)]
#[derive(Debug, Default, Serialize)]
pub struct MessagesQuery {
#[serde(skip_serializing_if = "String::is_empty")]
pub from: String,

#[serde(skip_serializing_if = "String::is_empty")]
Expand Down
38 changes: 0 additions & 38 deletions crates/matrix/src/admin/resources/user_id.rs

This file was deleted.

28 changes: 23 additions & 5 deletions crates/test/src/matrix/room_admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
mod tests {
use std::{thread, time::Duration};

use futures::TryFutureExt;
use futures::{future, TryFutureExt};
use matrix::{
admin::resources::room::{ListRoomQuery, MessagesQuery, RoomService as AdminRoomService},
ruma_common::{RoomId, ServerName},
ruma_events::{room::name::OriginalRoomNameEvent, AnyTimelineEvent, TimelineEventType},
};

use tokio::sync::OnceCell;
Expand All @@ -22,15 +23,32 @@ mod tests {
admin,
} = TEST.get_or_init(util::init).await;

// TODO
thread::sleep(Duration::from_secs(5));

let resp: Vec<_> = AdminRoomService::get_all(admin, ListRoomQuery::default())
.map_ok(|resp| resp.rooms)
.await
.unwrap();

dbg!(samples.iter().map(|s| s.owner()).collect::<Vec<_>>());
while let Some(_) = future::try_join_all(resp.iter().map(|r| {
AdminRoomService::get_room_events(admin, &r.room_id, Default::default())
.map_ok(|resp| resp.chunk.deserialize().unwrap())
}))
.await
.map(|ok| {
ok.into_iter().find(|chunk| {
chunk
.iter()
.all(|event| event.event_type() != TimelineEventType::RoomName)
})
})
.unwrap()
{
tokio::time::sleep(Duration::from_secs(2)).await;
}

let resp: Vec<_> = AdminRoomService::get_all(admin, ListRoomQuery::default())
.map_ok(|resp| resp.rooms)
.await
.unwrap();

assert_eq!(
samples
Expand Down

0 comments on commit 4252307

Please sign in to comment.