Merge branch 'main' into fix_docker_caching
This commit is contained in:
commit
7101ac1b4b
11 changed files with 107 additions and 67 deletions
|
@ -1,5 +1,13 @@
|
||||||
use super::{post::Post, *};
|
use super::post::Post;
|
||||||
use crate::schema::{comment, comment_like, comment_saved};
|
use crate::{
|
||||||
|
naive_now,
|
||||||
|
schema::{comment, comment_like, comment_saved},
|
||||||
|
Crud,
|
||||||
|
Likeable,
|
||||||
|
Saveable,
|
||||||
|
};
|
||||||
|
use diesel::{dsl::*, result::Error, *};
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
use url::{ParseError, Url};
|
use url::{ParseError, Url};
|
||||||
|
|
||||||
// WITH RECURSIVE MyTree AS (
|
// WITH RECURSIVE MyTree AS (
|
||||||
|
@ -249,7 +257,16 @@ impl Saveable<CommentSavedForm> for CommentSaved {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{comment::*, community::*, post::*, tests::establish_unpooled_connection, user::*};
|
use crate::{
|
||||||
|
comment::*,
|
||||||
|
community::*,
|
||||||
|
post::*,
|
||||||
|
tests::establish_unpooled_connection,
|
||||||
|
user::*,
|
||||||
|
Crud,
|
||||||
|
ListingType,
|
||||||
|
SortType,
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_crud() {
|
fn test_crud() {
|
||||||
|
|
|
@ -14,7 +14,7 @@ pub extern crate sha2;
|
||||||
pub extern crate strum;
|
pub extern crate strum;
|
||||||
|
|
||||||
use chrono::NaiveDateTime;
|
use chrono::NaiveDateTime;
|
||||||
use diesel::{dsl::*, result::Error, *};
|
use diesel::{result::Error, *};
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::{env, env::VarError};
|
use std::{env, env::VarError};
|
||||||
|
|
|
@ -2,7 +2,7 @@ use crate::{
|
||||||
schema::{password_reset_request, password_reset_request::dsl::*},
|
schema::{password_reset_request, password_reset_request::dsl::*},
|
||||||
Crud,
|
Crud,
|
||||||
};
|
};
|
||||||
use diesel::{dsl::*, result::Error, *};
|
use diesel::{dsl::*, result::Error, PgConnection, *};
|
||||||
use sha2::{Digest, Sha256};
|
use sha2::{Digest, Sha256};
|
||||||
|
|
||||||
#[derive(Queryable, Identifiable, PartialEq, Debug)]
|
#[derive(Queryable, Identifiable, PartialEq, Debug)]
|
||||||
|
@ -78,8 +78,14 @@ impl PasswordResetRequest {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{super::user::*, *};
|
use super::super::user::*;
|
||||||
use crate::{tests::establish_unpooled_connection, ListingType, SortType};
|
use crate::{
|
||||||
|
password_reset_request::PasswordResetRequest,
|
||||||
|
tests::establish_unpooled_connection,
|
||||||
|
Crud,
|
||||||
|
ListingType,
|
||||||
|
SortType,
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_crud() {
|
fn test_crud() {
|
||||||
|
|
|
@ -121,7 +121,10 @@ impl PrivateMessage {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO use this
|
// 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::*;
|
use crate::schema::private_message::dsl::*;
|
||||||
insert_into(private_message)
|
insert_into(private_message)
|
||||||
.values(private_message_form)
|
.values(private_message_form)
|
||||||
|
|
|
@ -523,36 +523,36 @@ joinable!(user_mention -> comment (comment_id));
|
||||||
joinable!(user_mention -> user_ (recipient_id));
|
joinable!(user_mention -> user_ (recipient_id));
|
||||||
|
|
||||||
allow_tables_to_appear_in_same_query!(
|
allow_tables_to_appear_in_same_query!(
|
||||||
activity,
|
activity,
|
||||||
category,
|
category,
|
||||||
comment,
|
comment,
|
||||||
comment_aggregates_fast,
|
comment_aggregates_fast,
|
||||||
comment_like,
|
comment_like,
|
||||||
comment_saved,
|
comment_saved,
|
||||||
community,
|
community,
|
||||||
community_aggregates_fast,
|
community_aggregates_fast,
|
||||||
community_follower,
|
community_follower,
|
||||||
community_moderator,
|
community_moderator,
|
||||||
community_user_ban,
|
community_user_ban,
|
||||||
mod_add,
|
mod_add,
|
||||||
mod_add_community,
|
mod_add_community,
|
||||||
mod_ban,
|
mod_ban,
|
||||||
mod_ban_from_community,
|
mod_ban_from_community,
|
||||||
mod_lock_post,
|
mod_lock_post,
|
||||||
mod_remove_comment,
|
mod_remove_comment,
|
||||||
mod_remove_community,
|
mod_remove_community,
|
||||||
mod_remove_post,
|
mod_remove_post,
|
||||||
mod_sticky_post,
|
mod_sticky_post,
|
||||||
password_reset_request,
|
password_reset_request,
|
||||||
post,
|
post,
|
||||||
post_aggregates_fast,
|
post_aggregates_fast,
|
||||||
post_like,
|
post_like,
|
||||||
post_read,
|
post_read,
|
||||||
post_saved,
|
post_saved,
|
||||||
private_message,
|
private_message,
|
||||||
site,
|
site,
|
||||||
user_,
|
user_,
|
||||||
user_ban,
|
user_ban,
|
||||||
user_fast,
|
user_fast,
|
||||||
user_mention,
|
user_mention,
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,6 +1,14 @@
|
||||||
use super::*;
|
|
||||||
use crate::{
|
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,
|
apub::ActorType,
|
||||||
blocking,
|
blocking,
|
||||||
websocket::{
|
websocket::{
|
||||||
|
@ -8,14 +16,22 @@ use crate::{
|
||||||
UserOperation,
|
UserOperation,
|
||||||
},
|
},
|
||||||
ConnectionId,
|
ConnectionId,
|
||||||
|
LemmyContext,
|
||||||
|
LemmyError,
|
||||||
};
|
};
|
||||||
|
use actix_web::web::Data;
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use lemmy_db::{
|
use lemmy_db::{
|
||||||
comment::Comment,
|
comment::Comment,
|
||||||
comment_view::CommentQueryBuilder,
|
comment_view::CommentQueryBuilder,
|
||||||
|
community::*,
|
||||||
|
community_view::*,
|
||||||
diesel_option_overwrite,
|
diesel_option_overwrite,
|
||||||
|
moderator::*,
|
||||||
naive_now,
|
naive_now,
|
||||||
post::Post,
|
post::Post,
|
||||||
|
site::*,
|
||||||
|
user_view::*,
|
||||||
Bannable,
|
Bannable,
|
||||||
Crud,
|
Crud,
|
||||||
Followable,
|
Followable,
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
use crate::{api::claims::Claims, blocking, ConnectionId, DbPool, LemmyContext, LemmyError};
|
use crate::{api::claims::Claims, blocking, ConnectionId, DbPool, LemmyContext, LemmyError};
|
||||||
use actix_web::web::Data;
|
use actix_web::web::Data;
|
||||||
use lemmy_db::{
|
use lemmy_db::{
|
||||||
community::*,
|
community::Community,
|
||||||
community_view::*,
|
community_view::CommunityUserBanView,
|
||||||
moderator::*,
|
|
||||||
post::Post,
|
post::Post,
|
||||||
site::*,
|
user::User_,
|
||||||
user::*,
|
|
||||||
user_view::*,
|
|
||||||
Crud,
|
Crud,
|
||||||
};
|
};
|
||||||
use lemmy_utils::{slur_check, slurs_vec_to_str};
|
use lemmy_utils::{slur_check, slurs_vec_to_str};
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
use super::*;
|
|
||||||
use crate::{
|
use crate::{
|
||||||
api::{comment::*, community::*, post::*, site::*, user::*, *},
|
api::{comment::*, community::*, post::*, site::*, user::*, APIError},
|
||||||
rate_limit::RateLimit,
|
rate_limit::RateLimit,
|
||||||
websocket::{
|
websocket::{
|
||||||
handlers::{do_user_operation, to_json_string, Args},
|
handlers::{do_user_operation, to_json_string, Args},
|
||||||
|
@ -15,10 +14,22 @@ use crate::{
|
||||||
PostId,
|
PostId,
|
||||||
UserId,
|
UserId,
|
||||||
};
|
};
|
||||||
|
use actix::prelude::*;
|
||||||
use anyhow::Context as acontext;
|
use anyhow::Context as acontext;
|
||||||
use background_jobs::QueueHandle;
|
use background_jobs::QueueHandle;
|
||||||
|
use diesel::{
|
||||||
|
r2d2::{ConnectionManager, Pool},
|
||||||
|
PgConnection,
|
||||||
|
};
|
||||||
use lemmy_utils::location_info;
|
use lemmy_utils::location_info;
|
||||||
|
use rand::rngs::ThreadRng;
|
||||||
use reqwest::Client;
|
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
|
/// `ChatServer` manages chat rooms and responsible for coordinating chat
|
||||||
/// session.
|
/// session.
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
use super::*;
|
|
||||||
use crate::{
|
use crate::{
|
||||||
api::Perform,
|
api::Perform,
|
||||||
rate_limit::RateLimit,
|
rate_limit::RateLimit,
|
||||||
|
@ -12,8 +11,12 @@ use crate::{
|
||||||
LemmyContext,
|
LemmyContext,
|
||||||
LemmyError,
|
LemmyError,
|
||||||
};
|
};
|
||||||
|
use actix::{Actor, Context, Handler, ResponseFuture};
|
||||||
use actix_web::web;
|
use actix_web::web;
|
||||||
use lemmy_db::naive_now;
|
use lemmy_db::naive_now;
|
||||||
|
use log::{error, info};
|
||||||
|
use rand::Rng;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
pub(super) struct Args<'a> {
|
pub(super) struct Args<'a> {
|
||||||
pub(super) context: LemmyContext,
|
pub(super) context: LemmyContext,
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
use super::*;
|
|
||||||
use crate::{
|
use crate::{
|
||||||
api::{comment::*, post::*},
|
api::{comment::CommentResponse, post::PostResponse},
|
||||||
websocket::UserOperation,
|
websocket::UserOperation,
|
||||||
CommunityId,
|
CommunityId,
|
||||||
ConnectionId,
|
ConnectionId,
|
||||||
|
@ -8,6 +7,8 @@ use crate::{
|
||||||
PostId,
|
PostId,
|
||||||
UserId,
|
UserId,
|
||||||
};
|
};
|
||||||
|
use actix::{prelude::*, Recipient};
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Chat server sends this messages to session
|
/// Chat server sends this messages to session
|
||||||
#[derive(Message)]
|
#[derive(Message)]
|
||||||
|
|
|
@ -2,20 +2,6 @@ pub mod chat_server;
|
||||||
pub mod handlers;
|
pub mod handlers;
|
||||||
pub mod messages;
|
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)]
|
#[derive(EnumString, ToString, Debug, Clone)]
|
||||||
pub enum UserOperation {
|
pub enum UserOperation {
|
||||||
Login,
|
Login,
|
||||||
|
|
Loading…
Reference in a new issue