1 use crate::db::category::*;
2 use crate::db::comment::*;
3 use crate::db::comment_view::*;
4 use crate::db::community::*;
5 use crate::db::community_view::*;
6 use crate::db::moderator::*;
7 use crate::db::moderator_views::*;
8 use crate::db::password_reset_request::*;
9 use crate::db::post::*;
10 use crate::db::post_view::*;
11 use crate::db::private_message::*;
12 use crate::db::private_message_view::*;
13 use crate::db::site::*;
14 use crate::db::site_view::*;
15 use crate::db::user::*;
16 use crate::db::user_mention::*;
17 use crate::db::user_mention_view::*;
18 use crate::db::user_view::*;
21 extract_usernames, fetch_iframely_and_pictshare_data, generate_random_string, naive_from_unix,
22 naive_now, remove_slurs, send_email, slur_check, slurs_vec_to_str,
26 fetcher::search_by_apub_id,
27 signatures::generate_actor_keypair,
28 {make_apub_endpoint, ActorType, ApubLikeableType, ApubObjectType, EndpointType},
30 use crate::settings::Settings;
31 use crate::websocket::{
33 JoinCommunityRoom, JoinPostRoom, JoinUserRoom, SendAllMessage, SendComment,
34 SendCommunityRoomMessage, SendPost, SendUserRoomMessage,
36 UserOperation, WebsocketInfo,
38 use diesel::r2d2::{ConnectionManager, Pool};
39 use diesel::PgConnection;
41 use log::{debug, error, info};
42 use serde::{Deserialize, Serialize};
43 use std::str::FromStr;
51 #[derive(Fail, Debug)]
52 #[fail(display = "{{\"error\":\"{}\"}}", message)]
58 pub fn err(msg: &str) -> Self {
60 message: msg.to_string(),
69 impl<Data> Oper<Data> {
70 pub fn new(data: Data) -> Oper<Data> {
76 type Response: serde::ser::Serialize + Send;
80 pool: Pool<ConnectionManager<PgConnection>>,
81 websocket_info: Option<WebsocketInfo>,
82 ) -> Result<Self::Response, Error>;