-use super::{post::Post, *};
+use super::{post::Post};
use crate::schema::{comment, comment_like, comment_saved};
use url::{ParseError, Url};
+use diesel::{dsl::*, result::Error, *};
+use serde::{Deserialize, Serialize};
+use crate::{Crud, naive_now, Likeable, Saveable};
// WITH RECURSIVE MyTree AS (
// SELECT * FROM comment WHERE parent_id IS NULL
#[cfg(test)]
mod tests {
- use crate::{comment::*, community::*, post::*, tests::establish_unpooled_connection, user::*};
+ use crate::{comment::*, community::*, post::*, tests::establish_unpooled_connection, user::*, SortType, ListingType};
+ use crate::Crud;
#[test]
fn test_crud() {
pub extern crate strum;
use chrono::NaiveDateTime;
-use diesel::{dsl::*, result::Error, *};
+use diesel::{result::Error, *};
use regex::Regex;
use serde::{Deserialize, Serialize};
use std::{env, env::VarError};
schema::{password_reset_request, password_reset_request::dsl::*},
Crud,
};
-use diesel::{dsl::*, result::Error, *};
+use diesel::{dsl::*, result::Error, PgConnection, *};
use sha2::{Digest, Sha256};
#[derive(Queryable, Identifiable, PartialEq, Debug)]
#[cfg(test)]
mod tests {
- use super::{super::user::*, *};
+ use super::{super::user::*};
use crate::{tests::establish_unpooled_connection, ListingType, SortType};
+ use crate::password_reset_request::PasswordResetRequest;
+ use crate::Crud;
#[test]
fn test_crud() {
}
// TODO use this
- pub fn upsert(conn: &PgConnection, private_message_form: &PrivateMessageForm) -> Result<Self, Error> {
+ pub fn upsert(
+ conn: &PgConnection,
+ private_message_form: &PrivateMessageForm,
+ ) -> Result<Self, Error> {
use crate::schema::private_message::dsl::*;
insert_into(private_message)
.values(private_message_form)
-use super::*;
use crate::{
- api::{is_admin, is_mod_or_admin, APIError, Perform},
+ api::{
+ check_slurs,
+ check_slurs_opt,
+ get_user_from_jwt,
+ get_user_from_jwt_opt,
+ is_admin,
+ is_mod_or_admin,
+ APIError,
+ Perform,
+ },
apub::ActorType,
blocking,
websocket::{
UserOperation,
},
ConnectionId,
+ LemmyContext,
+ LemmyError,
};
+use actix_web::web::Data;
use anyhow::Context;
use lemmy_db::{
comment::Comment,
comment_view::CommentQueryBuilder,
+ community::*,
+ community_view::*,
diesel_option_overwrite,
+ moderator::*,
naive_now,
post::Post,
+ site::*,
+ user_view::*,
Bannable,
Crud,
Followable,
use crate::{api::claims::Claims, blocking, ConnectionId, DbPool, LemmyContext, LemmyError};
use actix_web::web::Data;
use lemmy_db::{
- community::*,
- community_view::*,
- moderator::*,
+ community::Community,
+ community_view::CommunityUserBanView,
post::Post,
- site::*,
- user::*,
- user_view::*,
+ user::User_,
Crud,
};
use lemmy_utils::{slur_check, slurs_vec_to_str};
-use super::*;
use crate::{
- api::{comment::*, community::*, post::*, site::*, user::*, *},
+ api::{comment::*, community::*, post::*, site::*, user::*, APIError},
rate_limit::RateLimit,
websocket::{
handlers::{do_user_operation, to_json_string, Args},
PostId,
UserId,
};
+use actix::prelude::*;
use anyhow::Context as acontext;
use background_jobs::QueueHandle;
+use diesel::{
+ r2d2::{ConnectionManager, Pool},
+ PgConnection,
+};
use lemmy_utils::location_info;
+use rand::rngs::ThreadRng;
use reqwest::Client;
+use serde::Serialize;
+use serde_json::Value;
+use std::{
+ collections::{HashMap, HashSet},
+ str::FromStr,
+};
/// `ChatServer` manages chat rooms and responsible for coordinating chat
/// session.
-use super::*;
use crate::{
api::Perform,
rate_limit::RateLimit,
LemmyContext,
LemmyError,
};
+use actix::{Actor, Context, Handler, ResponseFuture};
use actix_web::web;
use lemmy_db::naive_now;
+use log::{error, info};
+use rand::Rng;
+use serde::{Deserialize, Serialize};
pub(super) struct Args<'a> {
pub(super) context: LemmyContext,
-use super::*;
use crate::{
- api::{comment::*, post::*},
+ api::{comment::CommentResponse, post::PostResponse},
websocket::UserOperation,
CommunityId,
ConnectionId,
PostId,
UserId,
};
+use actix::{prelude::*, Recipient};
+use serde::{Deserialize, Serialize};
/// Chat server sends this messages to session
#[derive(Message)]
pub mod handlers;
pub mod messages;
-use actix::prelude::*;
-use diesel::{
- r2d2::{ConnectionManager, Pool},
- PgConnection,
-};
-use log::{error, info};
-use rand::{rngs::ThreadRng, Rng};
-use serde::{Deserialize, Serialize};
-use serde_json::Value;
-use std::{
- collections::{HashMap, HashSet},
- str::FromStr,
-};
-
#[derive(EnumString, ToString, Debug, Clone)]
pub enum UserOperation {
Login,