-extern crate serde;
-extern crate log;
-extern crate diesel;
extern crate actix_web;
+extern crate diesel;
+extern crate log;
+extern crate serde;
pub mod comment;
pub mod community;
pub mod site;
pub mod user;
-use lemmy_db::comment::Comment;
-use lemmy_db::user::User_;
-use lemmy_db::post::Post;
-use lemmy_db::user_mention::{UserMentionForm, UserMention};
-use log::error;
-use lemmy_db::{Crud, DbPool};
-use lemmy_utils::utils::MentionData;
-use lemmy_utils::settings::Settings;
-use lemmy_utils::email::send_email;
use diesel::PgConnection;
-use lemmy_utils::LemmyError;
+use lemmy_db::{
+ comment::Comment,
+ post::Post,
+ user::User_,
+ user_mention::{UserMention, UserMentionForm},
+ Crud,
+ DbPool,
+};
+use lemmy_utils::{email::send_email, settings::Settings, utils::MentionData, LemmyError};
+use log::error;
pub async fn blocking<F, T>(pool: &DbPool, f: F) -> Result<T, LemmyError>
- where
- F: FnOnce(&diesel::PgConnection) -> T + Send + 'static,
- T: Send + 'static,
+where
+ F: FnOnce(&diesel::PgConnection) -> T + Send + 'static,
+ T: Send + 'static,
{
let pool = pool.clone();
let res = actix_web::web::block(move || {
let res = (f)(&conn);
Ok(res) as Result<_, LemmyError>
})
- .await?;
+ .await?;
Ok(res)
}
let ids = blocking(pool, move |conn| {
do_send_local_notifs(conn, &mentions, &comment, &user2, &post, do_send_email)
})
- .await?;
+ .await?;
Ok(ids)
}