Skip to content

Commit

Permalink
formatting ...
Browse files Browse the repository at this point in the history
  • Loading branch information
avdb13 committed Mar 26, 2024
1 parent c2cb34c commit 38bbb29
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 21 deletions.
5 changes: 4 additions & 1 deletion crates/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@ impl Commune {

let token = token.into();
let from = format!("commune@{host}");
let html = format!("<p>Thanks for signing up.\n\nUse this code to finish verifying your email:\n{token}</p>");
let html = format!(
"<p>Thanks for signing up.\n\nUse this code to finish verifying your \
email:\n{token}</p>"
);
let text = format!(
"Thanks for signing up.\n\nUse this code to finish verifying your email:\n{token}"
);
Expand Down
6 changes: 1 addition & 5 deletions crates/matrix/src/admin/registration_tokens/new.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ pub struct Request {
}

impl Request {
pub fn new(
token: String,
uses_allowed: usize,
expiry_time: usize,
) -> Self {
pub fn new(token: String, uses_allowed: usize, expiry_time: usize) -> Self {
Self {
token,
uses_allowed,
Expand Down
2 changes: 1 addition & 1 deletion crates/matrix/src/client/logout/root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use ruma_common::{
api::{request, response, Metadata},
metadata,
};
use serde::{Serialize, Deserialize};
use serde::{Deserialize, Serialize};

#[allow(dead_code)]
const METADATA: Metadata = metadata! {
Expand Down
5 changes: 4 additions & 1 deletion crates/router/src/api/account/display_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ use axum::{
response::{IntoResponse, Response},
Json,
};
use axum_extra::{headers::{authorization::Bearer, Authorization}, TypedHeader};
use axum_extra::{
headers::{authorization::Bearer, Authorization},
TypedHeader,
};
use serde::Deserialize;

#[derive(Debug, Deserialize)]
Expand Down
7 changes: 1 addition & 6 deletions crates/router/src/api/relative/register.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@ pub struct Payload {
pub async fn handler(Json(payload): Json<Payload>) -> Response {
use commune::account::register::service;

match service(
payload.username,
payload.password,
)
.await
{
match service(payload.username, payload.password).await {
Ok(resp) => Json(resp).into_response(),
Err(e) => {
tracing::warn!(?e, "failed to create account");
Expand Down
7 changes: 5 additions & 2 deletions crates/router/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ pub mod api;
pub async fn routes() -> Router {
let router = Router::new()
.route("/register", post(api::relative::register::handler))
.route("/register/available/:username", get(api::relative::available::handler))
.route(
"/register/available/:username",
get(api::relative::available::handler),
)
.route("/login", post(api::relative::login::handler))
.route("/logout", post(api::relative::logout::handler))
.nest(
Expand All @@ -20,7 +23,7 @@ pub async fn routes() -> Router {
.route("/whoami", get(api::account::whoami::handler))
.route("/password", put(api::account::password::handler))
.route("/display_name", put(api::account::display_name::handler))
.route("/avatar", put(api::account::avatar::handler))
.route("/avatar", put(api::account::avatar::handler)),
);

Router::new().nest("/_commune/client/r0", router)
Expand Down
2 changes: 1 addition & 1 deletion crates/test/src/api/relative.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub mod available;
pub mod login;
pub mod logout;
pub mod register;
pub mod available;
1 change: 1 addition & 0 deletions crates/test/src/api/relative/available.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

3 changes: 1 addition & 2 deletions crates/test/src/api/relative/login.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ pub async fn login(client: &Env) -> Result<Response, reqwest::Error> {
.await
.unwrap();

resp.json::<Response>()
.await
resp.json::<Response>().await
}

#[tokio::test]
Expand Down
2 changes: 1 addition & 1 deletion crates/test/src/api/relative/register.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ async fn register_test() {

tracing::info!(?resp);

// assert!(!resp.access_token.is_some() && resp.access_token.map(|at| !at.is_empty()).unwrap());
assert!(resp.access_token.is_some() && resp.access_token.map(|at| !at.is_empty()).unwrap());
}
2 changes: 1 addition & 1 deletion crates/test/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ impl Env {
.build()
.unwrap();


if let Err(e) = client
.get(commune::commune().config.matrix.host.to_string() + "/_matrix/client/versions")
.send()
Expand All @@ -52,6 +51,7 @@ impl Env {
format!("http://{}{}", self.loopback, path)
}

#[allow(dead_code)]
pub(crate) fn get(&self, url: &str) -> reqwest::RequestBuilder {
tracing::info!("GET {}", self.path(url));

Expand Down

0 comments on commit 38bbb29

Please sign in to comment.