Merge websocket crate into api_common

This commit is contained in:
Felix Ableitner 2022-11-26 03:04:46 +01:00
parent 70e3feb174
commit 030afbc2e7
170 changed files with 404 additions and 384 deletions

44
Cargo.lock generated
View file

@ -2050,7 +2050,6 @@ dependencies = [
"lemmy_db_views_actor", "lemmy_db_views_actor",
"lemmy_db_views_moderator", "lemmy_db_views_moderator",
"lemmy_utils", "lemmy_utils",
"lemmy_websocket",
"serde", "serde",
"serde_json", "serde_json",
"serial_test", "serial_test",
@ -2063,8 +2062,12 @@ dependencies = [
name = "lemmy_api_common" name = "lemmy_api_common"
version = "0.16.5" version = "0.16.5"
dependencies = [ dependencies = [
"actix",
"actix-rt", "actix-rt",
"actix-web", "actix-web",
"actix-web-actors",
"anyhow",
"background-jobs",
"chrono", "chrono",
"diesel", "diesel",
"encoding", "encoding",
@ -2073,13 +2076,20 @@ dependencies = [
"lemmy_db_views_actor", "lemmy_db_views_actor",
"lemmy_db_views_moderator", "lemmy_db_views_moderator",
"lemmy_utils", "lemmy_utils",
"opentelemetry 0.17.0",
"percent-encoding", "percent-encoding",
"rand 0.8.5",
"regex", "regex",
"reqwest", "reqwest",
"reqwest-middleware", "reqwest-middleware",
"rosetta-i18n", "rosetta-i18n",
"serde", "serde",
"serde_json",
"strum",
"strum_macros",
"tokio",
"tracing", "tracing",
"tracing-opentelemetry 0.17.4",
"url", "url",
"webpage", "webpage",
] ]
@ -2098,7 +2108,6 @@ dependencies = [
"lemmy_db_views", "lemmy_db_views",
"lemmy_db_views_actor", "lemmy_db_views_actor",
"lemmy_utils", "lemmy_utils",
"lemmy_websocket",
"serde", "serde",
"serde_json", "serde_json",
"tracing", "tracing",
@ -2131,7 +2140,6 @@ dependencies = [
"lemmy_db_views", "lemmy_db_views",
"lemmy_db_views_actor", "lemmy_db_views_actor",
"lemmy_utils", "lemmy_utils",
"lemmy_websocket",
"once_cell", "once_cell",
"reqwest", "reqwest",
"reqwest-middleware", "reqwest-middleware",
@ -2228,7 +2236,6 @@ dependencies = [
"lemmy_db_views", "lemmy_db_views",
"lemmy_db_views_actor", "lemmy_db_views_actor",
"lemmy_utils", "lemmy_utils",
"lemmy_websocket",
"once_cell", "once_cell",
"reqwest", "reqwest",
"reqwest-middleware", "reqwest-middleware",
@ -2260,7 +2267,6 @@ dependencies = [
"lemmy_db_schema", "lemmy_db_schema",
"lemmy_routes", "lemmy_routes",
"lemmy_utils", "lemmy_utils",
"lemmy_websocket",
"opentelemetry 0.17.0", "opentelemetry 0.17.0",
"opentelemetry-otlp", "opentelemetry-otlp",
"parking_lot", "parking_lot",
@ -2317,34 +2323,6 @@ dependencies = [
"uuid", "uuid",
] ]
[[package]]
name = "lemmy_websocket"
version = "0.16.5"
dependencies = [
"actix",
"actix-web",
"actix-web-actors",
"anyhow",
"background-jobs",
"chrono",
"diesel",
"lemmy_api_common",
"lemmy_db_schema",
"lemmy_db_views",
"lemmy_db_views_actor",
"lemmy_utils",
"opentelemetry 0.17.0",
"rand 0.8.5",
"reqwest-middleware",
"serde",
"serde_json",
"strum",
"strum_macros",
"tokio",
"tracing",
"tracing-opentelemetry 0.17.4",
]
[[package]] [[package]]
name = "lettre" name = "lettre"
version = "0.10.1" version = "0.10.1"

View file

@ -45,7 +45,6 @@ members = [
"crates/db_views", "crates/db_views",
"crates/db_views_actor", "crates/db_views_actor",
"crates/db_views_actor", "crates/db_views_actor",
"crates/websocket",
"crates/routes" "crates/routes"
] ]
@ -56,7 +55,6 @@ lemmy_apub = { version = "=0.16.5", path = "./crates/apub" }
lemmy_utils = { version = "=0.16.5", path = "./crates/utils" } lemmy_utils = { version = "=0.16.5", path = "./crates/utils" }
lemmy_db_schema = { version = "=0.16.5", path = "./crates/db_schema" } lemmy_db_schema = { version = "=0.16.5", path = "./crates/db_schema" }
lemmy_api_common = { version = "=0.16.5", path = "./crates/api_common" } lemmy_api_common = { version = "=0.16.5", path = "./crates/api_common" }
lemmy_websocket = { version = "=0.16.5", path = "./crates/websocket" }
lemmy_routes = { version = "=0.16.5", path = "./crates/routes" } lemmy_routes = { version = "=0.16.5", path = "./crates/routes" }
lemmy_db_views = { version = "=0.16.5", path = "./crates/db_views" } lemmy_db_views = { version = "=0.16.5", path = "./crates/db_views" }
lemmy_db_views_actor = { version = "=0.16.5", path = "./crates/db_views_actor" } lemmy_db_views_actor = { version = "=0.16.5", path = "./crates/db_views_actor" }
@ -116,7 +114,6 @@ lemmy_apub = { workspace = true }
lemmy_utils = { workspace = true } lemmy_utils = { workspace = true }
lemmy_db_schema = { workspace = true } lemmy_db_schema = { workspace = true }
lemmy_api_common = { workspace = true } lemmy_api_common = { workspace = true }
lemmy_websocket = { workspace = true }
lemmy_routes = { workspace = true } lemmy_routes = { workspace = true }
activitypub_federation = { workspace = true } activitypub_federation = { workspace = true }
diesel = { workspace = true } diesel = { workspace = true }

View file

@ -21,7 +21,6 @@ lemmy_db_views = { workspace = true, features = ["full"] }
lemmy_db_views_moderator = { workspace = true, features = ["full"] } lemmy_db_views_moderator = { workspace = true, features = ["full"] }
lemmy_db_views_actor = { workspace = true, features = ["full"] } lemmy_db_views_actor = { workspace = true, features = ["full"] }
lemmy_api_common = { workspace = true, features = ["full"] } lemmy_api_common = { workspace = true, features = ["full"] }
lemmy_websocket = { workspace = true }
activitypub_federation = { workspace = true } activitypub_federation = { workspace = true }
diesel = { workspace = true } diesel = { workspace = true }
bcrypt = { workspace = true } bcrypt = { workspace = true }

View file

@ -3,6 +3,8 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
comment::{CommentResponse, CreateCommentLike}, comment::{CommentResponse, CreateCommentLike},
utils::{check_community_ban, check_downvotes_enabled, get_local_user_view_from_jwt}, utils::{check_community_ban, check_downvotes_enabled, get_local_user_view_from_jwt},
websocket::{send::send_comment_ws_message, UserOperation},
LemmyContext,
}; };
use lemmy_apub::{ use lemmy_apub::{
fetcher::post_or_comment::PostOrComment, fetcher::post_or_comment::PostOrComment,
@ -22,7 +24,6 @@ use lemmy_db_schema::{
}; };
use lemmy_db_views::structs::{CommentView, LocalUserView}; use lemmy_db_views::structs::{CommentView, LocalUserView};
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{send::send_comment_ws_message, LemmyContext, UserOperation};
use std::convert::TryInto; use std::convert::TryInto;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]

View file

@ -3,6 +3,7 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
comment::{CommentResponse, SaveComment}, comment::{CommentResponse, SaveComment},
utils::get_local_user_view_from_jwt, utils::get_local_user_view_from_jwt,
LemmyContext,
}; };
use lemmy_db_schema::{ use lemmy_db_schema::{
source::comment::{CommentSaved, CommentSavedForm}, source::comment::{CommentSaved, CommentSavedForm},
@ -10,7 +11,6 @@ use lemmy_db_schema::{
}; };
use lemmy_db_views::structs::CommentView; use lemmy_db_views::structs::CommentView;
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for SaveComment { impl Perform for SaveComment {

View file

@ -4,6 +4,8 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
comment::{CommentReportResponse, CreateCommentReport}, comment::{CommentReportResponse, CreateCommentReport},
utils::{check_community_ban, get_local_user_view_from_jwt}, utils::{check_community_ban, get_local_user_view_from_jwt},
websocket::{messages::SendModRoomMessage, UserOperation},
LemmyContext,
}; };
use lemmy_apub::protocol::activities::community::report::Report; use lemmy_apub::protocol::activities::community::report::Report;
use lemmy_db_schema::{ use lemmy_db_schema::{
@ -15,7 +17,6 @@ use lemmy_db_schema::{
}; };
use lemmy_db_views::structs::{CommentReportView, CommentView}; use lemmy_db_views::structs::{CommentReportView, CommentView};
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{messages::SendModRoomMessage, LemmyContext, UserOperation};
/// Creates a comment report and notifies the moderators of the community /// Creates a comment report and notifies the moderators of the community
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]

View file

@ -3,10 +3,10 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
comment::{ListCommentReports, ListCommentReportsResponse}, comment::{ListCommentReports, ListCommentReportsResponse},
utils::get_local_user_view_from_jwt, utils::get_local_user_view_from_jwt,
LemmyContext,
}; };
use lemmy_db_views::comment_report_view::CommentReportQuery; use lemmy_db_views::comment_report_view::CommentReportQuery;
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
/// Lists comment reports for a community if an id is supplied /// Lists comment reports for a community if an id is supplied
/// or returns all comment reports for communities a user moderates /// or returns all comment reports for communities a user moderates

View file

@ -3,11 +3,12 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
comment::{CommentReportResponse, ResolveCommentReport}, comment::{CommentReportResponse, ResolveCommentReport},
utils::{get_local_user_view_from_jwt, is_mod_or_admin}, utils::{get_local_user_view_from_jwt, is_mod_or_admin},
websocket::{messages::SendModRoomMessage, UserOperation},
LemmyContext,
}; };
use lemmy_db_schema::{source::comment_report::CommentReport, traits::Reportable}; use lemmy_db_schema::{source::comment_report::CommentReport, traits::Reportable};
use lemmy_db_views::structs::CommentReportView; use lemmy_db_views::structs::CommentReportView;
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{messages::SendModRoomMessage, LemmyContext, UserOperation};
/// Resolves or unresolves a comment report and notifies the moderators of the community /// Resolves or unresolves a comment report and notifies the moderators of the community
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]

View file

@ -3,6 +3,8 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
community::{AddModToCommunity, AddModToCommunityResponse}, community::{AddModToCommunity, AddModToCommunityResponse},
utils::{get_local_user_view_from_jwt, is_mod_or_admin}, utils::{get_local_user_view_from_jwt, is_mod_or_admin},
websocket::{messages::SendCommunityRoomMessage, UserOperation},
LemmyContext,
}; };
use lemmy_apub::{ use lemmy_apub::{
objects::{community::ApubCommunity, person::ApubPerson}, objects::{community::ApubCommunity, person::ApubPerson},
@ -18,7 +20,6 @@ use lemmy_db_schema::{
}; };
use lemmy_db_views_actor::structs::CommunityModeratorView; use lemmy_db_views_actor::structs::CommunityModeratorView;
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{messages::SendCommunityRoomMessage, LemmyContext, UserOperation};
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for AddModToCommunity { impl Perform for AddModToCommunity {

View file

@ -3,6 +3,8 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
community::{BanFromCommunity, BanFromCommunityResponse}, community::{BanFromCommunity, BanFromCommunityResponse},
utils::{get_local_user_view_from_jwt, is_mod_or_admin, remove_user_data_in_community}, utils::{get_local_user_view_from_jwt, is_mod_or_admin, remove_user_data_in_community},
websocket::{messages::SendCommunityRoomMessage, UserOperation},
LemmyContext,
}; };
use lemmy_apub::{ use lemmy_apub::{
activities::block::SiteOrCommunity, activities::block::SiteOrCommunity,
@ -25,7 +27,6 @@ use lemmy_db_schema::{
}; };
use lemmy_db_views_actor::structs::PersonViewSafe; use lemmy_db_views_actor::structs::PersonViewSafe;
use lemmy_utils::{error::LemmyError, utils::naive_from_unix, ConnectionId}; use lemmy_utils::{error::LemmyError, utils::naive_from_unix, ConnectionId};
use lemmy_websocket::{messages::SendCommunityRoomMessage, LemmyContext, UserOperation};
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for BanFromCommunity { impl Perform for BanFromCommunity {

View file

@ -3,6 +3,7 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
community::{BlockCommunity, BlockCommunityResponse}, community::{BlockCommunity, BlockCommunityResponse},
utils::get_local_user_view_from_jwt, utils::get_local_user_view_from_jwt,
LemmyContext,
}; };
use lemmy_apub::protocol::activities::following::undo_follow::UndoFollow; use lemmy_apub::protocol::activities::following::undo_follow::UndoFollow;
use lemmy_db_schema::{ use lemmy_db_schema::{
@ -14,7 +15,6 @@ use lemmy_db_schema::{
}; };
use lemmy_db_views_actor::structs::CommunityView; use lemmy_db_views_actor::structs::CommunityView;
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for BlockCommunity { impl Perform for BlockCommunity {

View file

@ -3,6 +3,7 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
community::{CommunityResponse, FollowCommunity}, community::{CommunityResponse, FollowCommunity},
utils::{check_community_ban, check_community_deleted_or_removed, get_local_user_view_from_jwt}, utils::{check_community_ban, check_community_deleted_or_removed, get_local_user_view_from_jwt},
LemmyContext,
}; };
use lemmy_apub::{ use lemmy_apub::{
objects::community::ApubCommunity, objects::community::ApubCommunity,
@ -17,7 +18,6 @@ use lemmy_db_schema::{
}; };
use lemmy_db_views_actor::structs::CommunityView; use lemmy_db_views_actor::structs::CommunityView;
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for FollowCommunity { impl Perform for FollowCommunity {

View file

@ -3,6 +3,8 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
community::{CommunityResponse, HideCommunity}, community::{CommunityResponse, HideCommunity},
utils::{get_local_user_view_from_jwt, is_admin}, utils::{get_local_user_view_from_jwt, is_admin},
websocket::{send::send_community_ws_message, UserOperationCrud},
LemmyContext,
}; };
use lemmy_apub::protocol::activities::community::update::UpdateCommunity; use lemmy_apub::protocol::activities::community::update::UpdateCommunity;
use lemmy_db_schema::{ use lemmy_db_schema::{
@ -13,7 +15,6 @@ use lemmy_db_schema::{
traits::Crud, traits::Crud,
}; };
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{send::send_community_ws_message, LemmyContext, UserOperationCrud};
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for HideCommunity { impl Perform for HideCommunity {

View file

@ -4,6 +4,7 @@ use anyhow::Context;
use lemmy_api_common::{ use lemmy_api_common::{
community::{GetCommunityResponse, TransferCommunity}, community::{GetCommunityResponse, TransferCommunity},
utils::get_local_user_view_from_jwt, utils::get_local_user_view_from_jwt,
LemmyContext,
}; };
use lemmy_db_schema::{ use lemmy_db_schema::{
source::{ source::{
@ -14,7 +15,6 @@ use lemmy_db_schema::{
}; };
use lemmy_db_views_actor::structs::{CommunityModeratorView, CommunityView, PersonViewSafe}; use lemmy_db_views_actor::structs::{CommunityModeratorView, CommunityView, PersonViewSafe};
use lemmy_utils::{error::LemmyError, location_info, ConnectionId}; use lemmy_utils::{error::LemmyError, location_info, ConnectionId};
use lemmy_websocket::LemmyContext;
// TODO: we dont do anything for federation here, it should be updated the next time the community // TODO: we dont do anything for federation here, it should be updated the next time the community
// gets fetched. i hope we can get rid of the community creator role soon. // gets fetched. i hope we can get rid of the community creator role soon.

View file

@ -66,11 +66,15 @@ use lemmy_api_common::{
Search, Search,
}, },
utils::local_site_to_slur_regex, utils::local_site_to_slur_regex,
websocket::{CommunityJoin, ModJoin, PostJoin, UserJoin}, websocket::{
serialize_websocket_message,
structs::{CommunityJoin, ModJoin, PostJoin, UserJoin},
UserOperation,
},
LemmyContext,
}; };
use lemmy_db_schema::source::local_site::LocalSite; use lemmy_db_schema::source::local_site::LocalSite;
use lemmy_utils::{error::LemmyError, utils::check_slurs, ConnectionId}; use lemmy_utils::{error::LemmyError, utils::check_slurs, ConnectionId};
use lemmy_websocket::{serialize_websocket_message, LemmyContext, UserOperation};
use serde::Deserialize; use serde::Deserialize;
mod comment; mod comment;

View file

@ -3,6 +3,8 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
person::{AddAdmin, AddAdminResponse}, person::{AddAdmin, AddAdminResponse},
utils::{get_local_user_view_from_jwt, is_admin}, utils::{get_local_user_view_from_jwt, is_admin},
websocket::{messages::SendAllMessage, UserOperation},
LemmyContext,
}; };
use lemmy_db_schema::{ use lemmy_db_schema::{
source::{ source::{
@ -13,7 +15,6 @@ use lemmy_db_schema::{
}; };
use lemmy_db_views_actor::structs::PersonViewSafe; use lemmy_db_views_actor::structs::PersonViewSafe;
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{messages::SendAllMessage, LemmyContext, UserOperation};
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for AddAdmin { impl Perform for AddAdmin {

View file

@ -3,6 +3,8 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
person::{BanPerson, BanPersonResponse}, person::{BanPerson, BanPersonResponse},
utils::{get_local_user_view_from_jwt, is_admin, remove_user_data}, utils::{get_local_user_view_from_jwt, is_admin, remove_user_data},
websocket::{messages::SendAllMessage, UserOperation},
LemmyContext,
}; };
use lemmy_apub::{ use lemmy_apub::{
activities::block::SiteOrCommunity, activities::block::SiteOrCommunity,
@ -18,7 +20,6 @@ use lemmy_db_schema::{
use lemmy_db_views::structs::SiteView; use lemmy_db_views::structs::SiteView;
use lemmy_db_views_actor::structs::PersonViewSafe; use lemmy_db_views_actor::structs::PersonViewSafe;
use lemmy_utils::{error::LemmyError, utils::naive_from_unix, ConnectionId}; use lemmy_utils::{error::LemmyError, utils::naive_from_unix, ConnectionId};
use lemmy_websocket::{messages::SendAllMessage, LemmyContext, UserOperation};
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for BanPerson { impl Perform for BanPerson {

View file

@ -3,6 +3,7 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
person::{BlockPerson, BlockPersonResponse}, person::{BlockPerson, BlockPersonResponse},
utils::get_local_user_view_from_jwt, utils::get_local_user_view_from_jwt,
LemmyContext,
}; };
use lemmy_db_schema::{ use lemmy_db_schema::{
source::person_block::{PersonBlock, PersonBlockForm}, source::person_block::{PersonBlock, PersonBlockForm},
@ -10,7 +11,6 @@ use lemmy_db_schema::{
}; };
use lemmy_db_views_actor::structs::PersonViewSafe; use lemmy_db_views_actor::structs::PersonViewSafe;
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for BlockPerson { impl Perform for BlockPerson {

View file

@ -4,10 +4,10 @@ use bcrypt::verify;
use lemmy_api_common::{ use lemmy_api_common::{
person::{ChangePassword, LoginResponse}, person::{ChangePassword, LoginResponse},
utils::{get_local_user_view_from_jwt, password_length_check}, utils::{get_local_user_view_from_jwt, password_length_check},
LemmyContext,
}; };
use lemmy_db_schema::source::local_user::LocalUser; use lemmy_db_schema::source::local_user::LocalUser;
use lemmy_utils::{claims::Claims, error::LemmyError, ConnectionId}; use lemmy_utils::{claims::Claims, error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for ChangePassword { impl Perform for ChangePassword {

View file

@ -3,6 +3,7 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
person::{LoginResponse, PasswordChangeAfterReset}, person::{LoginResponse, PasswordChangeAfterReset},
utils::password_length_check, utils::password_length_check,
LemmyContext,
}; };
use lemmy_db_schema::source::{ use lemmy_db_schema::source::{
local_user::LocalUser, local_user::LocalUser,
@ -10,7 +11,6 @@ use lemmy_db_schema::source::{
}; };
use lemmy_db_views::structs::SiteView; use lemmy_db_views::structs::SiteView;
use lemmy_utils::{claims::Claims, error::LemmyError, ConnectionId}; use lemmy_utils::{claims::Claims, error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for PasswordChangeAfterReset { impl Perform for PasswordChangeAfterReset {

View file

@ -2,10 +2,13 @@ use crate::{captcha_as_wav_base64, Perform};
use actix_web::web::Data; use actix_web::web::Data;
use captcha::{gen, Difficulty}; use captcha::{gen, Difficulty};
use chrono::Duration; use chrono::Duration;
use lemmy_api_common::person::{CaptchaResponse, GetCaptcha, GetCaptchaResponse}; use lemmy_api_common::{
person::{CaptchaResponse, GetCaptcha, GetCaptchaResponse},
websocket::messages::CaptchaItem,
LemmyContext,
};
use lemmy_db_schema::{source::local_site::LocalSite, utils::naive_now}; use lemmy_db_schema::{source::local_site::LocalSite, utils::naive_now};
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{messages::CaptchaItem, LemmyContext};
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for GetCaptcha { impl Perform for GetCaptcha {

View file

@ -3,10 +3,10 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
person::{BannedPersonsResponse, GetBannedPersons}, person::{BannedPersonsResponse, GetBannedPersons},
utils::{get_local_user_view_from_jwt, is_admin}, utils::{get_local_user_view_from_jwt, is_admin},
LemmyContext,
}; };
use lemmy_db_views_actor::structs::PersonViewSafe; use lemmy_db_views_actor::structs::PersonViewSafe;
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for GetBannedPersons { impl Perform for GetBannedPersons {

View file

@ -4,11 +4,11 @@ use bcrypt::verify;
use lemmy_api_common::{ use lemmy_api_common::{
person::{Login, LoginResponse}, person::{Login, LoginResponse},
utils::{check_registration_application, check_user_valid}, utils::{check_registration_application, check_user_valid},
LemmyContext,
}; };
use lemmy_db_schema::source::local_site::LocalSite; use lemmy_db_schema::source::local_site::LocalSite;
use lemmy_db_views::structs::LocalUserView; use lemmy_db_views::structs::LocalUserView;
use lemmy_utils::{claims::Claims, error::LemmyError, ConnectionId}; use lemmy_utils::{claims::Claims, error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for Login { impl Perform for Login {

View file

@ -3,10 +3,10 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
person::{GetPersonMentions, GetPersonMentionsResponse}, person::{GetPersonMentions, GetPersonMentionsResponse},
utils::get_local_user_view_from_jwt, utils::get_local_user_view_from_jwt,
LemmyContext,
}; };
use lemmy_db_views_actor::person_mention_view::PersonMentionQuery; use lemmy_db_views_actor::person_mention_view::PersonMentionQuery;
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for GetPersonMentions { impl Perform for GetPersonMentions {

View file

@ -3,10 +3,10 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
person::{GetReplies, GetRepliesResponse}, person::{GetReplies, GetRepliesResponse},
utils::get_local_user_view_from_jwt, utils::get_local_user_view_from_jwt,
LemmyContext,
}; };
use lemmy_db_views_actor::comment_reply_view::CommentReplyQuery; use lemmy_db_views_actor::comment_reply_view::CommentReplyQuery;
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for GetReplies { impl Perform for GetReplies {

View file

@ -3,6 +3,7 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
person::{GetRepliesResponse, MarkAllAsRead}, person::{GetRepliesResponse, MarkAllAsRead},
utils::get_local_user_view_from_jwt, utils::get_local_user_view_from_jwt,
LemmyContext,
}; };
use lemmy_db_schema::source::{ use lemmy_db_schema::source::{
comment_reply::CommentReply, comment_reply::CommentReply,
@ -10,7 +11,6 @@ use lemmy_db_schema::source::{
private_message::PrivateMessage, private_message::PrivateMessage,
}; };
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for MarkAllAsRead { impl Perform for MarkAllAsRead {

View file

@ -3,6 +3,7 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
person::{MarkPersonMentionAsRead, PersonMentionResponse}, person::{MarkPersonMentionAsRead, PersonMentionResponse},
utils::get_local_user_view_from_jwt, utils::get_local_user_view_from_jwt,
LemmyContext,
}; };
use lemmy_db_schema::{ use lemmy_db_schema::{
source::person_mention::{PersonMention, PersonMentionUpdateForm}, source::person_mention::{PersonMention, PersonMentionUpdateForm},
@ -10,7 +11,6 @@ use lemmy_db_schema::{
}; };
use lemmy_db_views_actor::structs::PersonMentionView; use lemmy_db_views_actor::structs::PersonMentionView;
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for MarkPersonMentionAsRead { impl Perform for MarkPersonMentionAsRead {

View file

@ -3,6 +3,7 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
person::{CommentReplyResponse, MarkCommentReplyAsRead}, person::{CommentReplyResponse, MarkCommentReplyAsRead},
utils::get_local_user_view_from_jwt, utils::get_local_user_view_from_jwt,
LemmyContext,
}; };
use lemmy_db_schema::{ use lemmy_db_schema::{
source::comment_reply::{CommentReply, CommentReplyUpdateForm}, source::comment_reply::{CommentReply, CommentReplyUpdateForm},
@ -10,7 +11,6 @@ use lemmy_db_schema::{
}; };
use lemmy_db_views_actor::structs::CommentReplyView; use lemmy_db_views_actor::structs::CommentReplyView;
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for MarkCommentReplyAsRead { impl Perform for MarkCommentReplyAsRead {

View file

@ -3,11 +3,11 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
person::{GetUnreadCount, GetUnreadCountResponse}, person::{GetUnreadCount, GetUnreadCountResponse},
utils::get_local_user_view_from_jwt, utils::get_local_user_view_from_jwt,
LemmyContext,
}; };
use lemmy_db_views::structs::PrivateMessageView; use lemmy_db_views::structs::PrivateMessageView;
use lemmy_db_views_actor::structs::{CommentReplyView, PersonMentionView}; use lemmy_db_views_actor::structs::{CommentReplyView, PersonMentionView};
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for GetUnreadCount { impl Perform for GetUnreadCount {

View file

@ -3,10 +3,10 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
person::{GetReportCount, GetReportCountResponse}, person::{GetReportCount, GetReportCountResponse},
utils::get_local_user_view_from_jwt, utils::get_local_user_view_from_jwt,
LemmyContext,
}; };
use lemmy_db_views::structs::{CommentReportView, PostReportView, PrivateMessageReportView}; use lemmy_db_views::structs::{CommentReportView, PostReportView, PrivateMessageReportView};
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for GetReportCount { impl Perform for GetReportCount {

View file

@ -3,10 +3,10 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
person::{PasswordReset, PasswordResetResponse}, person::{PasswordReset, PasswordResetResponse},
utils::send_password_reset_email, utils::send_password_reset_email,
LemmyContext,
}; };
use lemmy_db_views::structs::LocalUserView; use lemmy_db_views::structs::LocalUserView;
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for PasswordReset { impl Perform for PasswordReset {

View file

@ -3,6 +3,7 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
person::{LoginResponse, SaveUserSettings}, person::{LoginResponse, SaveUserSettings},
utils::{get_local_user_view_from_jwt, send_verification_email}, utils::{get_local_user_view_from_jwt, send_verification_email},
LemmyContext,
}; };
use lemmy_db_schema::{ use lemmy_db_schema::{
source::{ source::{
@ -20,7 +21,6 @@ use lemmy_utils::{
utils::{is_valid_display_name, is_valid_matrix_id}, utils::{is_valid_display_name, is_valid_matrix_id},
ConnectionId, ConnectionId,
}; };
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for SaveUserSettings { impl Perform for SaveUserSettings {

View file

@ -3,6 +3,7 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
person::{VerifyEmail, VerifyEmailResponse}, person::{VerifyEmail, VerifyEmailResponse},
utils::send_email_verification_success, utils::send_email_verification_success,
LemmyContext,
}; };
use lemmy_db_schema::{ use lemmy_db_schema::{
source::{ source::{
@ -13,7 +14,6 @@ use lemmy_db_schema::{
}; };
use lemmy_db_views::structs::LocalUserView; use lemmy_db_views::structs::LocalUserView;
use lemmy_utils::error::LemmyError; use lemmy_utils::error::LemmyError;
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for VerifyEmail { impl Perform for VerifyEmail {

View file

@ -3,9 +3,9 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
post::{GetSiteMetadata, GetSiteMetadataResponse}, post::{GetSiteMetadata, GetSiteMetadataResponse},
request::fetch_site_metadata, request::fetch_site_metadata,
LemmyContext,
}; };
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for GetSiteMetadata { impl Perform for GetSiteMetadata {

View file

@ -9,6 +9,8 @@ use lemmy_api_common::{
get_local_user_view_from_jwt, get_local_user_view_from_jwt,
mark_post_as_read, mark_post_as_read,
}, },
websocket::{send::send_post_ws_message, UserOperation},
LemmyContext,
}; };
use lemmy_apub::{ use lemmy_apub::{
fetcher::post_or_comment::PostOrComment, fetcher::post_or_comment::PostOrComment,
@ -26,7 +28,6 @@ use lemmy_db_schema::{
traits::{Crud, Likeable}, traits::{Crud, Likeable},
}; };
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{send::send_post_ws_message, LemmyContext, UserOperation};
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for CreatePostLike { impl Perform for CreatePostLike {

View file

@ -8,6 +8,8 @@ use lemmy_api_common::{
get_local_user_view_from_jwt, get_local_user_view_from_jwt,
is_mod_or_admin, is_mod_or_admin,
}, },
websocket::{send::send_post_ws_message, UserOperation},
LemmyContext,
}; };
use lemmy_apub::{ use lemmy_apub::{
objects::post::ApubPost, objects::post::ApubPost,
@ -21,7 +23,6 @@ use lemmy_db_schema::{
traits::Crud, traits::Crud,
}; };
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{send::send_post_ws_message, LemmyContext, UserOperation};
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for LockPost { impl Perform for LockPost {

View file

@ -3,10 +3,10 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
post::{MarkPostAsRead, PostResponse}, post::{MarkPostAsRead, PostResponse},
utils::{get_local_user_view_from_jwt, mark_post_as_read, mark_post_as_unread}, utils::{get_local_user_view_from_jwt, mark_post_as_read, mark_post_as_unread},
LemmyContext,
}; };
use lemmy_db_views::structs::PostView; use lemmy_db_views::structs::PostView;
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for MarkPostAsRead { impl Perform for MarkPostAsRead {

View file

@ -3,6 +3,7 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
post::{PostResponse, SavePost}, post::{PostResponse, SavePost},
utils::{get_local_user_view_from_jwt, mark_post_as_read}, utils::{get_local_user_view_from_jwt, mark_post_as_read},
LemmyContext,
}; };
use lemmy_db_schema::{ use lemmy_db_schema::{
source::post::{PostSaved, PostSavedForm}, source::post::{PostSaved, PostSavedForm},
@ -10,7 +11,6 @@ use lemmy_db_schema::{
}; };
use lemmy_db_views::structs::PostView; use lemmy_db_views::structs::PostView;
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for SavePost { impl Perform for SavePost {

View file

@ -8,6 +8,8 @@ use lemmy_api_common::{
get_local_user_view_from_jwt, get_local_user_view_from_jwt,
is_mod_or_admin, is_mod_or_admin,
}, },
websocket::{send::send_post_ws_message, UserOperation},
LemmyContext,
}; };
use lemmy_apub::{ use lemmy_apub::{
objects::post::ApubPost, objects::post::ApubPost,
@ -21,7 +23,6 @@ use lemmy_db_schema::{
traits::Crud, traits::Crud,
}; };
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{send::send_post_ws_message, LemmyContext, UserOperation};
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for StickyPost { impl Perform for StickyPost {

View file

@ -4,6 +4,8 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
post::{CreatePostReport, PostReportResponse}, post::{CreatePostReport, PostReportResponse},
utils::{check_community_ban, get_local_user_view_from_jwt}, utils::{check_community_ban, get_local_user_view_from_jwt},
websocket::{messages::SendModRoomMessage, UserOperation},
LemmyContext,
}; };
use lemmy_apub::protocol::activities::community::report::Report; use lemmy_apub::protocol::activities::community::report::Report;
use lemmy_db_schema::{ use lemmy_db_schema::{
@ -15,7 +17,6 @@ use lemmy_db_schema::{
}; };
use lemmy_db_views::structs::{PostReportView, PostView}; use lemmy_db_views::structs::{PostReportView, PostView};
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{messages::SendModRoomMessage, LemmyContext, UserOperation};
/// Creates a post report and notifies the moderators of the community /// Creates a post report and notifies the moderators of the community
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]

View file

@ -3,10 +3,10 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
post::{ListPostReports, ListPostReportsResponse}, post::{ListPostReports, ListPostReportsResponse},
utils::get_local_user_view_from_jwt, utils::get_local_user_view_from_jwt,
LemmyContext,
}; };
use lemmy_db_views::post_report_view::PostReportQuery; use lemmy_db_views::post_report_view::PostReportQuery;
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
/// Lists post reports for a community if an id is supplied /// Lists post reports for a community if an id is supplied
/// or returns all post reports for communities a user moderates /// or returns all post reports for communities a user moderates

View file

@ -3,11 +3,12 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
post::{PostReportResponse, ResolvePostReport}, post::{PostReportResponse, ResolvePostReport},
utils::{get_local_user_view_from_jwt, is_mod_or_admin}, utils::{get_local_user_view_from_jwt, is_mod_or_admin},
websocket::{messages::SendModRoomMessage, UserOperation},
LemmyContext,
}; };
use lemmy_db_schema::{source::post_report::PostReport, traits::Reportable}; use lemmy_db_schema::{source::post_report::PostReport, traits::Reportable};
use lemmy_db_views::structs::PostReportView; use lemmy_db_views::structs::PostReportView;
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{messages::SendModRoomMessage, LemmyContext, UserOperation};
/// Resolves or unresolves a post report and notifies the moderators of the community /// Resolves or unresolves a post report and notifies the moderators of the community
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]

View file

@ -3,13 +3,14 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
private_message::{MarkPrivateMessageAsRead, PrivateMessageResponse}, private_message::{MarkPrivateMessageAsRead, PrivateMessageResponse},
utils::get_local_user_view_from_jwt, utils::get_local_user_view_from_jwt,
websocket::{send::send_pm_ws_message, UserOperation},
LemmyContext,
}; };
use lemmy_db_schema::{ use lemmy_db_schema::{
source::private_message::{PrivateMessage, PrivateMessageUpdateForm}, source::private_message::{PrivateMessage, PrivateMessageUpdateForm},
traits::Crud, traits::Crud,
}; };
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{send::send_pm_ws_message, LemmyContext, UserOperation};
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for MarkPrivateMessageAsRead { impl Perform for MarkPrivateMessageAsRead {

View file

@ -3,6 +3,8 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
private_message::{CreatePrivateMessageReport, PrivateMessageReportResponse}, private_message::{CreatePrivateMessageReport, PrivateMessageReportResponse},
utils::get_local_user_view_from_jwt, utils::get_local_user_view_from_jwt,
websocket::{messages::SendModRoomMessage, UserOperation},
LemmyContext,
}; };
use lemmy_db_schema::{ use lemmy_db_schema::{
newtypes::CommunityId, newtypes::CommunityId,
@ -15,7 +17,6 @@ use lemmy_db_schema::{
}; };
use lemmy_db_views::structs::PrivateMessageReportView; use lemmy_db_views::structs::PrivateMessageReportView;
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{messages::SendModRoomMessage, LemmyContext, UserOperation};
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for CreatePrivateMessageReport { impl Perform for CreatePrivateMessageReport {

View file

@ -3,10 +3,10 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
private_message::{ListPrivateMessageReports, ListPrivateMessageReportsResponse}, private_message::{ListPrivateMessageReports, ListPrivateMessageReportsResponse},
utils::{get_local_user_view_from_jwt, is_admin}, utils::{get_local_user_view_from_jwt, is_admin},
LemmyContext,
}; };
use lemmy_db_views::private_message_report_view::PrivateMessageReportQuery; use lemmy_db_views::private_message_report_view::PrivateMessageReportQuery;
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for ListPrivateMessageReports { impl Perform for ListPrivateMessageReports {

View file

@ -3,6 +3,8 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
private_message::{PrivateMessageReportResponse, ResolvePrivateMessageReport}, private_message::{PrivateMessageReportResponse, ResolvePrivateMessageReport},
utils::{get_local_user_view_from_jwt, is_admin}, utils::{get_local_user_view_from_jwt, is_admin},
websocket::{messages::SendModRoomMessage, UserOperation},
LemmyContext,
}; };
use lemmy_db_schema::{ use lemmy_db_schema::{
newtypes::CommunityId, newtypes::CommunityId,
@ -11,7 +13,6 @@ use lemmy_db_schema::{
}; };
use lemmy_db_views::structs::PrivateMessageReportView; use lemmy_db_views::structs::PrivateMessageReportView;
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{messages::SendModRoomMessage, LemmyContext, UserOperation};
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for ResolvePrivateMessageReport { impl Perform for ResolvePrivateMessageReport {

View file

@ -3,6 +3,7 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
site::{GetSiteResponse, LeaveAdmin}, site::{GetSiteResponse, LeaveAdmin},
utils::{get_local_user_view_from_jwt, is_admin}, utils::{get_local_user_view_from_jwt, is_admin},
LemmyContext,
}; };
use lemmy_db_schema::{ use lemmy_db_schema::{
source::{ source::{
@ -17,7 +18,6 @@ use lemmy_db_schema::{
use lemmy_db_views::structs::SiteView; use lemmy_db_views::structs::SiteView;
use lemmy_db_views_actor::structs::PersonViewSafe; use lemmy_db_views_actor::structs::PersonViewSafe;
use lemmy_utils::{error::LemmyError, version, ConnectionId}; use lemmy_utils::{error::LemmyError, version, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for LeaveAdmin { impl Perform for LeaveAdmin {

View file

@ -3,6 +3,7 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
site::{GetModlog, GetModlogResponse}, site::{GetModlog, GetModlogResponse},
utils::{check_private_instance, get_local_user_view_from_jwt_opt, is_admin, is_mod_or_admin}, utils::{check_private_instance, get_local_user_view_from_jwt_opt, is_admin, is_mod_or_admin},
LemmyContext,
}; };
use lemmy_db_schema::{ use lemmy_db_schema::{
newtypes::{CommunityId, PersonId}, newtypes::{CommunityId, PersonId},
@ -28,7 +29,6 @@ use lemmy_db_views_moderator::structs::{
ModlogListParams, ModlogListParams,
}; };
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
use ModlogActionType::*; use ModlogActionType::*;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]

View file

@ -3,6 +3,7 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
site::{PurgeComment, PurgeItemResponse}, site::{PurgeComment, PurgeItemResponse},
utils::{get_local_user_view_from_jwt, is_admin}, utils::{get_local_user_view_from_jwt, is_admin},
LemmyContext,
}; };
use lemmy_db_schema::{ use lemmy_db_schema::{
source::{ source::{
@ -12,7 +13,6 @@ use lemmy_db_schema::{
traits::Crud, traits::Crud,
}; };
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for PurgeComment { impl Perform for PurgeComment {

View file

@ -4,6 +4,7 @@ use lemmy_api_common::{
request::purge_image_from_pictrs, request::purge_image_from_pictrs,
site::{PurgeCommunity, PurgeItemResponse}, site::{PurgeCommunity, PurgeItemResponse},
utils::{get_local_user_view_from_jwt, is_admin, purge_image_posts_for_community}, utils::{get_local_user_view_from_jwt, is_admin, purge_image_posts_for_community},
LemmyContext,
}; };
use lemmy_db_schema::{ use lemmy_db_schema::{
source::{ source::{
@ -13,7 +14,6 @@ use lemmy_db_schema::{
traits::Crud, traits::Crud,
}; };
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for PurgeCommunity { impl Perform for PurgeCommunity {

View file

@ -4,6 +4,7 @@ use lemmy_api_common::{
request::purge_image_from_pictrs, request::purge_image_from_pictrs,
site::{PurgeItemResponse, PurgePerson}, site::{PurgeItemResponse, PurgePerson},
utils::{get_local_user_view_from_jwt, is_admin, purge_image_posts_for_person}, utils::{get_local_user_view_from_jwt, is_admin, purge_image_posts_for_person},
LemmyContext,
}; };
use lemmy_db_schema::{ use lemmy_db_schema::{
source::{ source::{
@ -13,7 +14,6 @@ use lemmy_db_schema::{
traits::Crud, traits::Crud,
}; };
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for PurgePerson { impl Perform for PurgePerson {

View file

@ -4,6 +4,7 @@ use lemmy_api_common::{
request::purge_image_from_pictrs, request::purge_image_from_pictrs,
site::{PurgeItemResponse, PurgePost}, site::{PurgeItemResponse, PurgePost},
utils::{get_local_user_view_from_jwt, is_admin}, utils::{get_local_user_view_from_jwt, is_admin},
LemmyContext,
}; };
use lemmy_db_schema::{ use lemmy_db_schema::{
source::{ source::{
@ -13,7 +14,6 @@ use lemmy_db_schema::{
traits::Crud, traits::Crud,
}; };
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for PurgePost { impl Perform for PurgePost {

View file

@ -3,6 +3,7 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
site::{ApproveRegistrationApplication, RegistrationApplicationResponse}, site::{ApproveRegistrationApplication, RegistrationApplicationResponse},
utils::{get_local_user_view_from_jwt, is_admin, send_application_approved_email}, utils::{get_local_user_view_from_jwt, is_admin, send_application_approved_email},
LemmyContext,
}; };
use lemmy_db_schema::{ use lemmy_db_schema::{
source::{ source::{
@ -14,7 +15,6 @@ use lemmy_db_schema::{
}; };
use lemmy_db_views::structs::{LocalUserView, RegistrationApplicationView}; use lemmy_db_views::structs::{LocalUserView, RegistrationApplicationView};
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for ApproveRegistrationApplication { impl Perform for ApproveRegistrationApplication {

View file

@ -3,11 +3,11 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
site::{ListRegistrationApplications, ListRegistrationApplicationsResponse}, site::{ListRegistrationApplications, ListRegistrationApplicationsResponse},
utils::{get_local_user_view_from_jwt, is_admin}, utils::{get_local_user_view_from_jwt, is_admin},
LemmyContext,
}; };
use lemmy_db_schema::source::local_site::LocalSite; use lemmy_db_schema::source::local_site::LocalSite;
use lemmy_db_views::registration_application_view::RegistrationApplicationQuery; use lemmy_db_views::registration_application_view::RegistrationApplicationQuery;
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
/// Lists registration applications, filterable by undenied only. /// Lists registration applications, filterable by undenied only.
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]

View file

@ -3,11 +3,11 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
site::{GetUnreadRegistrationApplicationCount, GetUnreadRegistrationApplicationCountResponse}, site::{GetUnreadRegistrationApplicationCount, GetUnreadRegistrationApplicationCountResponse},
utils::{get_local_user_view_from_jwt, is_admin}, utils::{get_local_user_view_from_jwt, is_admin},
LemmyContext,
}; };
use lemmy_db_schema::source::local_site::LocalSite; use lemmy_db_schema::source::local_site::LocalSite;
use lemmy_db_views::structs::RegistrationApplicationView; use lemmy_db_views::structs::RegistrationApplicationView;
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for GetUnreadRegistrationApplicationCount { impl Perform for GetUnreadRegistrationApplicationCount {

View file

@ -4,13 +4,13 @@ use diesel::NotFound;
use lemmy_api_common::{ use lemmy_api_common::{
site::{ResolveObject, ResolveObjectResponse}, site::{ResolveObject, ResolveObjectResponse},
utils::{check_private_instance, get_local_user_view_from_jwt_opt}, utils::{check_private_instance, get_local_user_view_from_jwt_opt},
LemmyContext,
}; };
use lemmy_apub::fetcher::search::{search_query_to_object_id, SearchableObjects}; use lemmy_apub::fetcher::search::{search_query_to_object_id, SearchableObjects};
use lemmy_db_schema::{newtypes::PersonId, source::local_site::LocalSite, utils::DbPool}; use lemmy_db_schema::{newtypes::PersonId, source::local_site::LocalSite, utils::DbPool};
use lemmy_db_views::structs::{CommentView, PostView}; use lemmy_db_views::structs::{CommentView, PostView};
use lemmy_db_views_actor::structs::{CommunityView, PersonViewSafe}; use lemmy_db_views_actor::structs::{CommunityView, PersonViewSafe};
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for ResolveObject { impl Perform for ResolveObject {

View file

@ -3,6 +3,7 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
site::{Search, SearchResponse}, site::{Search, SearchResponse},
utils::{check_private_instance, get_local_user_view_from_jwt_opt}, utils::{check_private_instance, get_local_user_view_from_jwt_opt},
LemmyContext,
}; };
use lemmy_apub::{fetcher::resolve_actor_identifier, objects::community::ApubCommunity}; use lemmy_apub::{fetcher::resolve_actor_identifier, objects::community::ApubCommunity};
use lemmy_db_schema::{ use lemmy_db_schema::{
@ -14,7 +15,6 @@ use lemmy_db_schema::{
use lemmy_db_views::{comment_view::CommentQuery, post_view::PostQuery}; use lemmy_db_views::{comment_view::CommentQuery, post_view::PostQuery};
use lemmy_db_views_actor::{community_view::CommunityQuery, person_view::PersonQuery}; use lemmy_db_views_actor::{community_view::CommunityQuery, person_view::PersonQuery};
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for Search { impl Perform for Search {

View file

@ -3,6 +3,8 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
utils::get_local_user_view_from_jwt, utils::get_local_user_view_from_jwt,
websocket::{ websocket::{
messages::{JoinCommunityRoom, JoinModRoom, JoinPostRoom, JoinUserRoom},
structs::{
CommunityJoin, CommunityJoin,
CommunityJoinResponse, CommunityJoinResponse,
ModJoin, ModJoin,
@ -12,12 +14,10 @@ use lemmy_api_common::{
UserJoin, UserJoin,
UserJoinResponse, UserJoinResponse,
}, },
}; },
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{
messages::{JoinCommunityRoom, JoinModRoom, JoinPostRoom, JoinUserRoom},
LemmyContext, LemmyContext,
}; };
use lemmy_utils::{error::LemmyError, ConnectionId};
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl Perform for UserJoin { impl Perform for UserJoin {

View file

@ -36,6 +36,17 @@ rosetta-i18n = { workspace = true, optional = true }
percent-encoding = { workspace = true, optional = true } percent-encoding = { workspace = true, optional = true }
webpage = { version = "1.4.0", default-features = false, features = ["serde"], optional = true } webpage = { version = "1.4.0", default-features = false, features = ["serde"], optional = true }
encoding = { version = "0.2.33", optional = true } encoding = { version = "0.2.33", optional = true }
rand = { workspace = true }
serde_json = { workspace = true }
actix = { workspace = true }
anyhow = { workspace = true }
tokio = { workspace = true }
strum = { workspace = true }
strum_macros = { workspace = true }
opentelemetry = { workspace = true }
tracing-opentelemetry = { workspace = true }
actix-web-actors = { version = "4.1.0", default-features = false }
background-jobs = "0.13.0"
[dev-dependencies] [dev-dependencies]
actix-rt = { workspace = true } actix-rt = { workspace = true }

View file

@ -11,7 +11,78 @@ pub mod site;
pub mod utils; pub mod utils;
pub mod websocket; pub mod websocket;
#[macro_use]
extern crate strum_macros;
pub extern crate lemmy_db_schema; pub extern crate lemmy_db_schema;
pub extern crate lemmy_db_views; pub extern crate lemmy_db_views;
pub extern crate lemmy_db_views_actor; pub extern crate lemmy_db_views_actor;
pub extern crate lemmy_db_views_moderator; pub extern crate lemmy_db_views_moderator;
use crate::websocket::chat_server::ChatServer;
use actix::Addr;
use lemmy_db_schema::{source::secret::Secret, utils::DbPool};
use lemmy_utils::{
rate_limit::RateLimitCell,
settings::{structs::Settings, SETTINGS},
};
use reqwest_middleware::ClientWithMiddleware;
pub struct LemmyContext {
pool: DbPool,
chat_server: Addr<ChatServer>,
client: ClientWithMiddleware,
settings: Settings,
secret: Secret,
rate_limit_cell: RateLimitCell,
}
impl LemmyContext {
pub fn create(
pool: DbPool,
chat_server: Addr<ChatServer>,
client: ClientWithMiddleware,
settings: Settings,
secret: Secret,
settings_updated_channel: RateLimitCell,
) -> LemmyContext {
LemmyContext {
pool,
chat_server,
client,
settings,
secret,
rate_limit_cell: settings_updated_channel,
}
}
pub fn pool(&self) -> &DbPool {
&self.pool
}
pub fn chat_server(&self) -> &Addr<ChatServer> {
&self.chat_server
}
pub fn client(&self) -> &ClientWithMiddleware {
&self.client
}
pub fn settings(&self) -> &'static Settings {
&SETTINGS
}
pub fn secret(&self) -> &Secret {
&self.secret
}
pub fn settings_updated_channel(&self) -> &RateLimitCell {
&self.rate_limit_cell
}
}
impl Clone for LemmyContext {
fn clone(&self) -> Self {
LemmyContext {
pool: self.pool.clone(),
chat_server: self.chat_server.clone(),
client: self.client.clone(),
settings: self.settings.clone(),
secret: self.secret.clone(),
rate_limit_cell: self.rate_limit_cell.clone(),
}
}
}

View file

@ -1,14 +1,17 @@
use crate::{ use crate::{
comment::CommentResponse,
post::PostResponse,
websocket::{
messages::{CaptchaItem, StandardMessage, WsMessage}, messages::{CaptchaItem, StandardMessage, WsMessage},
serialize_websocket_message, serialize_websocket_message,
LemmyContext,
OperationType, OperationType,
UserOperation, UserOperation,
UserOperationCrud, UserOperationCrud,
},
LemmyContext,
}; };
use actix::prelude::*; use actix::prelude::*;
use anyhow::Context as acontext; use anyhow::Context as acontext;
use lemmy_api_common::{comment::CommentResponse, post::PostResponse};
use lemmy_db_schema::{ use lemmy_db_schema::{
newtypes::{CommunityId, LocalUserId, PostId}, newtypes::{CommunityId, LocalUserId, PostId},
source::secret::Secret, source::secret::Secret,

View file

@ -1,4 +1,4 @@
use crate::{ use crate::websocket::{
chat_server::{ChatServer, SessionInfo}, chat_server::{ChatServer, SessionInfo},
messages::{ messages::{
CaptchaItem, CaptchaItem,

View file

@ -1,6 +1,5 @@
use crate::UserOperation; use crate::{comment::CommentResponse, post::PostResponse, websocket::UserOperation};
use actix::{prelude::*, Recipient}; use actix::{prelude::*, Recipient};
use lemmy_api_common::{comment::CommentResponse, post::PostResponse};
use lemmy_db_schema::newtypes::{CommunityId, LocalUserId, PostId}; use lemmy_db_schema::newtypes::{CommunityId, LocalUserId, PostId};
use lemmy_utils::{ConnectionId, IpAddr}; use lemmy_utils::{ConnectionId, IpAddr};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};

View file

@ -1,15 +1,4 @@
#[macro_use] use lemmy_utils::error::LemmyError;
extern crate strum_macros;
use crate::chat_server::ChatServer;
use actix::Addr;
use lemmy_db_schema::{source::secret::Secret, utils::DbPool};
use lemmy_utils::{
error::LemmyError,
rate_limit::RateLimitCell,
settings::{structs::Settings, SETTINGS},
};
use reqwest_middleware::ClientWithMiddleware;
use serde::Serialize; use serde::Serialize;
pub mod chat_server; pub mod chat_server;
@ -17,66 +6,7 @@ pub mod handlers;
pub mod messages; pub mod messages;
pub mod routes; pub mod routes;
pub mod send; pub mod send;
pub mod structs;
pub struct LemmyContext {
pool: DbPool,
chat_server: Addr<ChatServer>,
client: ClientWithMiddleware,
settings: Settings,
secret: Secret,
rate_limit_cell: RateLimitCell,
}
impl LemmyContext {
pub fn create(
pool: DbPool,
chat_server: Addr<ChatServer>,
client: ClientWithMiddleware,
settings: Settings,
secret: Secret,
settings_updated_channel: RateLimitCell,
) -> LemmyContext {
LemmyContext {
pool,
chat_server,
client,
settings,
secret,
rate_limit_cell: settings_updated_channel,
}
}
pub fn pool(&self) -> &DbPool {
&self.pool
}
pub fn chat_server(&self) -> &Addr<ChatServer> {
&self.chat_server
}
pub fn client(&self) -> &ClientWithMiddleware {
&self.client
}
pub fn settings(&self) -> &'static Settings {
&SETTINGS
}
pub fn secret(&self) -> &Secret {
&self.secret
}
pub fn settings_updated_channel(&self) -> &RateLimitCell {
&self.rate_limit_cell
}
}
impl Clone for LemmyContext {
fn clone(&self) -> Self {
LemmyContext {
pool: self.pool.clone(),
chat_server: self.chat_server.clone(),
client: self.client.clone(),
settings: self.settings.clone(),
secret: self.secret.clone(),
rate_limit_cell: self.rate_limit_cell.clone(),
}
}
}
#[derive(Serialize)] #[derive(Serialize)]
struct WebsocketResponse<T> { struct WebsocketResponse<T> {

View file

@ -1,6 +1,8 @@
use crate::{ use crate::{
websocket::{
chat_server::ChatServer, chat_server::ChatServer,
messages::{Connect, Disconnect, StandardMessage, WsMessage}, messages::{Connect, Disconnect, StandardMessage, WsMessage},
},
LemmyContext, LemmyContext,
}; };
use actix::prelude::*; use actix::prelude::*;

View file

@ -1,14 +1,14 @@
use crate::{ use crate::{
messages::{SendComment, SendCommunityRoomMessage, SendPost, SendUserRoomMessage},
LemmyContext,
OperationType,
};
use lemmy_api_common::{
comment::CommentResponse, comment::CommentResponse,
community::CommunityResponse, community::CommunityResponse,
post::PostResponse, post::PostResponse,
private_message::PrivateMessageResponse, private_message::PrivateMessageResponse,
utils::{check_person_block, get_interface_language, send_email_to_user}, utils::{check_person_block, get_interface_language, send_email_to_user},
websocket::{
messages::{SendComment, SendCommunityRoomMessage, SendPost, SendUserRoomMessage},
OperationType,
},
LemmyContext,
}; };
use lemmy_db_schema::{ use lemmy_db_schema::{
newtypes::{CommentId, CommunityId, LocalUserId, PersonId, PostId, PrivateMessageId}, newtypes::{CommentId, CommunityId, LocalUserId, PersonId, PostId, PrivateMessageId},

View file

@ -15,7 +15,6 @@ lemmy_db_schema = { workspace = true, features = ["full"] }
lemmy_db_views = { workspace = true, features = ["full"] } lemmy_db_views = { workspace = true, features = ["full"] }
lemmy_db_views_actor = { workspace = true, features = ["full"] } lemmy_db_views_actor = { workspace = true, features = ["full"] }
lemmy_api_common = { workspace = true, features = ["full"] } lemmy_api_common = { workspace = true, features = ["full"] }
lemmy_websocket = { workspace = true }
activitypub_federation = { workspace = true } activitypub_federation = { workspace = true }
bcrypt = { workspace = true } bcrypt = { workspace = true }
serde_json = { workspace = true } serde_json = { workspace = true }

View file

@ -10,6 +10,11 @@ use lemmy_api_common::{
get_post, get_post,
local_site_to_slur_regex, local_site_to_slur_regex,
}, },
websocket::{
send::{send_comment_ws_message, send_local_notifs},
UserOperationCrud,
},
LemmyContext,
}; };
use lemmy_apub::{ use lemmy_apub::{
generate_local_apub_endpoint, generate_local_apub_endpoint,
@ -32,11 +37,6 @@ use lemmy_utils::{
utils::{remove_slurs, scrape_text_for_mentions}, utils::{remove_slurs, scrape_text_for_mentions},
ConnectionId, ConnectionId,
}; };
use lemmy_websocket::{
send::{send_comment_ws_message, send_local_notifs},
LemmyContext,
UserOperationCrud,
};
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl PerformCrud for CreateComment { impl PerformCrud for CreateComment {

View file

@ -3,6 +3,11 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
comment::{CommentResponse, DeleteComment}, comment::{CommentResponse, DeleteComment},
utils::{check_community_ban, get_local_user_view_from_jwt}, utils::{check_community_ban, get_local_user_view_from_jwt},
websocket::{
send::{send_comment_ws_message, send_local_notifs},
UserOperationCrud,
},
LemmyContext,
}; };
use lemmy_apub::activities::deletion::{send_apub_delete_in_community, DeletableObjects}; use lemmy_apub::activities::deletion::{send_apub_delete_in_community, DeletableObjects};
use lemmy_db_schema::{ use lemmy_db_schema::{
@ -15,11 +20,6 @@ use lemmy_db_schema::{
}; };
use lemmy_db_views::structs::CommentView; use lemmy_db_views::structs::CommentView;
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{
send::{send_comment_ws_message, send_local_notifs},
LemmyContext,
UserOperationCrud,
};
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl PerformCrud for DeleteComment { impl PerformCrud for DeleteComment {

View file

@ -7,6 +7,7 @@ use lemmy_api_common::{
get_local_user_view_from_jwt_opt, get_local_user_view_from_jwt_opt,
listing_type_with_site_default, listing_type_with_site_default,
}, },
LemmyContext,
}; };
use lemmy_apub::{fetcher::resolve_actor_identifier, objects::community::ApubCommunity}; use lemmy_apub::{fetcher::resolve_actor_identifier, objects::community::ApubCommunity};
use lemmy_db_schema::{ use lemmy_db_schema::{
@ -15,7 +16,6 @@ use lemmy_db_schema::{
}; };
use lemmy_db_views::comment_view::CommentQuery; use lemmy_db_views::comment_view::CommentQuery;
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl PerformCrud for GetComments { impl PerformCrud for GetComments {

View file

@ -3,11 +3,11 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
comment::{CommentResponse, GetComment}, comment::{CommentResponse, GetComment},
utils::{check_private_instance, get_local_user_view_from_jwt_opt}, utils::{check_private_instance, get_local_user_view_from_jwt_opt},
LemmyContext,
}; };
use lemmy_db_schema::source::local_site::LocalSite; use lemmy_db_schema::source::local_site::LocalSite;
use lemmy_db_views::structs::CommentView; use lemmy_db_views::structs::CommentView;
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl PerformCrud for GetComment { impl PerformCrud for GetComment {

View file

@ -3,6 +3,11 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
comment::{CommentResponse, RemoveComment}, comment::{CommentResponse, RemoveComment},
utils::{check_community_ban, get_local_user_view_from_jwt, is_mod_or_admin}, utils::{check_community_ban, get_local_user_view_from_jwt, is_mod_or_admin},
websocket::{
send::{send_comment_ws_message, send_local_notifs},
UserOperationCrud,
},
LemmyContext,
}; };
use lemmy_apub::activities::deletion::{send_apub_delete_in_community, DeletableObjects}; use lemmy_apub::activities::deletion::{send_apub_delete_in_community, DeletableObjects};
use lemmy_db_schema::{ use lemmy_db_schema::{
@ -16,11 +21,6 @@ use lemmy_db_schema::{
}; };
use lemmy_db_views::structs::CommentView; use lemmy_db_views::structs::CommentView;
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{
send::{send_comment_ws_message, send_local_notifs},
LemmyContext,
UserOperationCrud,
};
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl PerformCrud for RemoveComment { impl PerformCrud for RemoveComment {

View file

@ -10,6 +10,11 @@ use lemmy_api_common::{
is_mod_or_admin, is_mod_or_admin,
local_site_to_slur_regex, local_site_to_slur_regex,
}, },
websocket::{
send::{send_comment_ws_message, send_local_notifs},
UserOperationCrud,
},
LemmyContext,
}; };
use lemmy_apub::protocol::activities::{ use lemmy_apub::protocol::activities::{
create_or_update::note::CreateOrUpdateNote, create_or_update::note::CreateOrUpdateNote,
@ -29,11 +34,6 @@ use lemmy_utils::{
utils::{remove_slurs, scrape_text_for_mentions}, utils::{remove_slurs, scrape_text_for_mentions},
ConnectionId, ConnectionId,
}; };
use lemmy_websocket::{
send::{send_comment_ws_message, send_local_notifs},
LemmyContext,
UserOperationCrud,
};
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl PerformCrud for EditComment { impl PerformCrud for EditComment {

View file

@ -4,6 +4,7 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
community::{CommunityResponse, CreateCommunity}, community::{CommunityResponse, CreateCommunity},
utils::{get_local_user_view_from_jwt, is_admin, local_site_to_slur_regex}, utils::{get_local_user_view_from_jwt, is_admin, local_site_to_slur_regex},
LemmyContext,
}; };
use lemmy_apub::{ use lemmy_apub::{
generate_followers_url, generate_followers_url,
@ -32,7 +33,6 @@ use lemmy_utils::{
utils::{check_slurs, check_slurs_opt, is_valid_actor_name}, utils::{check_slurs, check_slurs_opt, is_valid_actor_name},
ConnectionId, ConnectionId,
}; };
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl PerformCrud for CreateCommunity { impl PerformCrud for CreateCommunity {

View file

@ -3,6 +3,8 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
community::{CommunityResponse, DeleteCommunity}, community::{CommunityResponse, DeleteCommunity},
utils::get_local_user_view_from_jwt, utils::get_local_user_view_from_jwt,
websocket::{send::send_community_ws_message, UserOperationCrud},
LemmyContext,
}; };
use lemmy_apub::activities::deletion::{send_apub_delete_in_community, DeletableObjects}; use lemmy_apub::activities::deletion::{send_apub_delete_in_community, DeletableObjects};
use lemmy_db_schema::{ use lemmy_db_schema::{
@ -11,7 +13,6 @@ use lemmy_db_schema::{
}; };
use lemmy_db_views_actor::structs::CommunityModeratorView; use lemmy_db_views_actor::structs::CommunityModeratorView;
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{send::send_community_ws_message, LemmyContext, UserOperationCrud};
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl PerformCrud for DeleteCommunity { impl PerformCrud for DeleteCommunity {

View file

@ -3,11 +3,11 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
community::{ListCommunities, ListCommunitiesResponse}, community::{ListCommunities, ListCommunitiesResponse},
utils::{check_private_instance, get_local_user_view_from_jwt_opt}, utils::{check_private_instance, get_local_user_view_from_jwt_opt},
LemmyContext,
}; };
use lemmy_db_schema::{source::local_site::LocalSite, traits::DeleteableOrRemoveable}; use lemmy_db_schema::{source::local_site::LocalSite, traits::DeleteableOrRemoveable};
use lemmy_db_views_actor::community_view::CommunityQuery; use lemmy_db_views_actor::community_view::CommunityQuery;
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl PerformCrud for ListCommunities { impl PerformCrud for ListCommunities {

View file

@ -3,6 +3,8 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
community::{GetCommunity, GetCommunityResponse}, community::{GetCommunity, GetCommunityResponse},
utils::{check_private_instance, get_local_user_view_from_jwt_opt}, utils::{check_private_instance, get_local_user_view_from_jwt_opt},
websocket::messages::GetCommunityUsersOnline,
LemmyContext,
}; };
use lemmy_apub::{ use lemmy_apub::{
fetcher::resolve_actor_identifier, fetcher::resolve_actor_identifier,
@ -20,7 +22,6 @@ use lemmy_db_schema::{
}; };
use lemmy_db_views_actor::structs::{CommunityModeratorView, CommunityView}; use lemmy_db_views_actor::structs::{CommunityModeratorView, CommunityView};
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{messages::GetCommunityUsersOnline, LemmyContext};
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl PerformCrud for GetCommunity { impl PerformCrud for GetCommunity {

View file

@ -3,6 +3,8 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
community::{CommunityResponse, RemoveCommunity}, community::{CommunityResponse, RemoveCommunity},
utils::{get_local_user_view_from_jwt, is_admin}, utils::{get_local_user_view_from_jwt, is_admin},
websocket::{send::send_community_ws_message, UserOperationCrud},
LemmyContext,
}; };
use lemmy_apub::activities::deletion::{send_apub_delete_in_community, DeletableObjects}; use lemmy_apub::activities::deletion::{send_apub_delete_in_community, DeletableObjects};
use lemmy_db_schema::{ use lemmy_db_schema::{
@ -13,7 +15,6 @@ use lemmy_db_schema::{
traits::Crud, traits::Crud,
}; };
use lemmy_utils::{error::LemmyError, utils::naive_from_unix, ConnectionId}; use lemmy_utils::{error::LemmyError, utils::naive_from_unix, ConnectionId};
use lemmy_websocket::{send::send_community_ws_message, LemmyContext, UserOperationCrud};
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl PerformCrud for RemoveCommunity { impl PerformCrud for RemoveCommunity {

View file

@ -3,6 +3,8 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
community::{CommunityResponse, EditCommunity}, community::{CommunityResponse, EditCommunity},
utils::{get_local_user_view_from_jwt, local_site_to_slur_regex}, utils::{get_local_user_view_from_jwt, local_site_to_slur_regex},
websocket::{send::send_community_ws_message, UserOperationCrud},
LemmyContext,
}; };
use lemmy_apub::protocol::activities::community::update::UpdateCommunity; use lemmy_apub::protocol::activities::community::update::UpdateCommunity;
use lemmy_db_schema::{ use lemmy_db_schema::{
@ -17,7 +19,6 @@ use lemmy_db_schema::{
}; };
use lemmy_db_views_actor::structs::CommunityModeratorView; use lemmy_db_views_actor::structs::CommunityModeratorView;
use lemmy_utils::{error::LemmyError, utils::check_slurs_opt, ConnectionId}; use lemmy_utils::{error::LemmyError, utils::check_slurs_opt, ConnectionId};
use lemmy_websocket::{send::send_community_ws_message, LemmyContext, UserOperationCrud};
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl PerformCrud for EditCommunity { impl PerformCrud for EditCommunity {

View file

@ -18,9 +18,10 @@ use lemmy_api_common::{
GetPrivateMessages, GetPrivateMessages,
}, },
site::{CreateSite, EditSite, GetSite}, site::{CreateSite, EditSite, GetSite},
websocket::{serialize_websocket_message, UserOperationCrud},
LemmyContext,
}; };
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{serialize_websocket_message, LemmyContext, UserOperationCrud};
use serde::Deserialize; use serde::Deserialize;
mod comment; mod comment;

View file

@ -11,6 +11,8 @@ use lemmy_api_common::{
local_site_to_slur_regex, local_site_to_slur_regex,
mark_post_as_read, mark_post_as_read,
}, },
websocket::{send::send_post_ws_message, UserOperationCrud},
LemmyContext,
}; };
use lemmy_apub::{ use lemmy_apub::{
generate_local_apub_endpoint, generate_local_apub_endpoint,
@ -34,7 +36,6 @@ use lemmy_utils::{
utils::{check_slurs, check_slurs_opt, clean_url_params, is_valid_post_title}, utils::{check_slurs, check_slurs_opt, clean_url_params, is_valid_post_title},
ConnectionId, ConnectionId,
}; };
use lemmy_websocket::{send::send_post_ws_message, LemmyContext, UserOperationCrud};
use tracing::{warn, Instrument}; use tracing::{warn, Instrument};
use url::Url; use url::Url;
use webmention::{Webmention, WebmentionError}; use webmention::{Webmention, WebmentionError};

View file

@ -3,6 +3,8 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
post::{DeletePost, PostResponse}, post::{DeletePost, PostResponse},
utils::{check_community_ban, check_community_deleted_or_removed, get_local_user_view_from_jwt}, utils::{check_community_ban, check_community_deleted_or_removed, get_local_user_view_from_jwt},
websocket::{send::send_post_ws_message, UserOperationCrud},
LemmyContext,
}; };
use lemmy_apub::activities::deletion::{send_apub_delete_in_community, DeletableObjects}; use lemmy_apub::activities::deletion::{send_apub_delete_in_community, DeletableObjects};
use lemmy_db_schema::{ use lemmy_db_schema::{
@ -13,7 +15,6 @@ use lemmy_db_schema::{
traits::Crud, traits::Crud,
}; };
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{send::send_post_ws_message, LemmyContext, UserOperationCrud};
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl PerformCrud for DeletePost { impl PerformCrud for DeletePost {

View file

@ -7,6 +7,7 @@ use lemmy_api_common::{
get_local_user_view_from_jwt_opt, get_local_user_view_from_jwt_opt,
listing_type_with_site_default, listing_type_with_site_default,
}, },
LemmyContext,
}; };
use lemmy_apub::{fetcher::resolve_actor_identifier, objects::community::ApubCommunity}; use lemmy_apub::{fetcher::resolve_actor_identifier, objects::community::ApubCommunity};
use lemmy_db_schema::{ use lemmy_db_schema::{
@ -15,7 +16,6 @@ use lemmy_db_schema::{
}; };
use lemmy_db_views::post_view::PostQuery; use lemmy_db_views::post_view::PostQuery;
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl PerformCrud for GetPosts { impl PerformCrud for GetPosts {

View file

@ -3,6 +3,8 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
post::{GetPost, GetPostResponse}, post::{GetPost, GetPostResponse},
utils::{check_private_instance, get_local_user_view_from_jwt_opt, mark_post_as_read}, utils::{check_private_instance, get_local_user_view_from_jwt_opt, mark_post_as_read},
websocket::messages::GetPostUsersOnline,
LemmyContext,
}; };
use lemmy_db_schema::{ use lemmy_db_schema::{
aggregates::structs::{PersonPostAggregates, PersonPostAggregatesForm}, aggregates::structs::{PersonPostAggregates, PersonPostAggregatesForm},
@ -12,7 +14,6 @@ use lemmy_db_schema::{
use lemmy_db_views::structs::PostView; use lemmy_db_views::structs::PostView;
use lemmy_db_views_actor::structs::{CommunityModeratorView, CommunityView}; use lemmy_db_views_actor::structs::{CommunityModeratorView, CommunityView};
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{messages::GetPostUsersOnline, LemmyContext};
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl PerformCrud for GetPost { impl PerformCrud for GetPost {

View file

@ -3,6 +3,8 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
post::{PostResponse, RemovePost}, post::{PostResponse, RemovePost},
utils::{check_community_ban, get_local_user_view_from_jwt, is_mod_or_admin}, utils::{check_community_ban, get_local_user_view_from_jwt, is_mod_or_admin},
websocket::{send::send_post_ws_message, UserOperationCrud},
LemmyContext,
}; };
use lemmy_apub::activities::deletion::{send_apub_delete_in_community, DeletableObjects}; use lemmy_apub::activities::deletion::{send_apub_delete_in_community, DeletableObjects};
use lemmy_db_schema::{ use lemmy_db_schema::{
@ -14,7 +16,6 @@ use lemmy_db_schema::{
traits::Crud, traits::Crud,
}; };
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{send::send_post_ws_message, LemmyContext, UserOperationCrud};
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl PerformCrud for RemovePost { impl PerformCrud for RemovePost {

View file

@ -9,6 +9,8 @@ use lemmy_api_common::{
get_local_user_view_from_jwt, get_local_user_view_from_jwt,
local_site_to_slur_regex, local_site_to_slur_regex,
}, },
websocket::{send::send_post_ws_message, UserOperationCrud},
LemmyContext,
}; };
use lemmy_apub::protocol::activities::{ use lemmy_apub::protocol::activities::{
create_or_update::page::CreateOrUpdatePage, create_or_update::page::CreateOrUpdatePage,
@ -28,7 +30,6 @@ use lemmy_utils::{
utils::{check_slurs_opt, clean_url_params, is_valid_post_title}, utils::{check_slurs_opt, clean_url_params, is_valid_post_title},
ConnectionId, ConnectionId,
}; };
use lemmy_websocket::{send::send_post_ws_message, LemmyContext, UserOperationCrud};
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl PerformCrud for EditPost { impl PerformCrud for EditPost {

View file

@ -9,6 +9,8 @@ use lemmy_api_common::{
local_site_to_slur_regex, local_site_to_slur_regex,
send_email_to_user, send_email_to_user,
}, },
websocket::{send::send_pm_ws_message, UserOperationCrud},
LemmyContext,
}; };
use lemmy_apub::{ use lemmy_apub::{
generate_local_apub_endpoint, generate_local_apub_endpoint,
@ -27,7 +29,6 @@ use lemmy_db_schema::{
}; };
use lemmy_db_views::structs::LocalUserView; use lemmy_db_views::structs::LocalUserView;
use lemmy_utils::{error::LemmyError, utils::remove_slurs, ConnectionId}; use lemmy_utils::{error::LemmyError, utils::remove_slurs, ConnectionId};
use lemmy_websocket::{send::send_pm_ws_message, LemmyContext, UserOperationCrud};
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl PerformCrud for CreatePrivateMessage { impl PerformCrud for CreatePrivateMessage {

View file

@ -3,6 +3,8 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
private_message::{DeletePrivateMessage, PrivateMessageResponse}, private_message::{DeletePrivateMessage, PrivateMessageResponse},
utils::get_local_user_view_from_jwt, utils::get_local_user_view_from_jwt,
websocket::{send::send_pm_ws_message, UserOperationCrud},
LemmyContext,
}; };
use lemmy_apub::activities::deletion::send_apub_delete_private_message; use lemmy_apub::activities::deletion::send_apub_delete_private_message;
use lemmy_db_schema::{ use lemmy_db_schema::{
@ -10,7 +12,6 @@ use lemmy_db_schema::{
traits::Crud, traits::Crud,
}; };
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{send::send_pm_ws_message, LemmyContext, UserOperationCrud};
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl PerformCrud for DeletePrivateMessage { impl PerformCrud for DeletePrivateMessage {

View file

@ -3,11 +3,11 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
private_message::{GetPrivateMessages, PrivateMessagesResponse}, private_message::{GetPrivateMessages, PrivateMessagesResponse},
utils::get_local_user_view_from_jwt, utils::get_local_user_view_from_jwt,
LemmyContext,
}; };
use lemmy_db_schema::traits::DeleteableOrRemoveable; use lemmy_db_schema::traits::DeleteableOrRemoveable;
use lemmy_db_views::private_message_view::PrivateMessageQuery; use lemmy_db_views::private_message_view::PrivateMessageQuery;
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl PerformCrud for GetPrivateMessages { impl PerformCrud for GetPrivateMessages {

View file

@ -3,6 +3,8 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
private_message::{EditPrivateMessage, PrivateMessageResponse}, private_message::{EditPrivateMessage, PrivateMessageResponse},
utils::{get_local_user_view_from_jwt, local_site_to_slur_regex}, utils::{get_local_user_view_from_jwt, local_site_to_slur_regex},
websocket::{send::send_pm_ws_message, UserOperationCrud},
LemmyContext,
}; };
use lemmy_apub::protocol::activities::{ use lemmy_apub::protocol::activities::{
create_or_update::chat_message::CreateOrUpdateChatMessage, create_or_update::chat_message::CreateOrUpdateChatMessage,
@ -17,7 +19,6 @@ use lemmy_db_schema::{
utils::naive_now, utils::naive_now,
}; };
use lemmy_utils::{error::LemmyError, utils::remove_slurs, ConnectionId}; use lemmy_utils::{error::LemmyError, utils::remove_slurs, ConnectionId};
use lemmy_websocket::{send::send_pm_ws_message, LemmyContext, UserOperationCrud};
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl PerformCrud for EditPrivateMessage { impl PerformCrud for EditPrivateMessage {

View file

@ -10,6 +10,7 @@ use lemmy_api_common::{
local_site_to_slur_regex, local_site_to_slur_regex,
site_description_length_check, site_description_length_check,
}, },
LemmyContext,
}; };
use lemmy_apub::generate_site_inbox_url; use lemmy_apub::generate_site_inbox_url;
use lemmy_db_schema::{ use lemmy_db_schema::{
@ -28,7 +29,6 @@ use lemmy_utils::{
utils::{check_application_question, check_slurs, check_slurs_opt}, utils::{check_application_question, check_slurs, check_slurs_opt},
ConnectionId, ConnectionId,
}; };
use lemmy_websocket::LemmyContext;
use url::Url; use url::Url;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]

View file

@ -3,6 +3,8 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
site::{GetSite, GetSiteResponse, MyUserInfo}, site::{GetSite, GetSiteResponse, MyUserInfo},
utils::{build_federated_instances, get_local_user_settings_view_from_jwt_opt}, utils::{build_federated_instances, get_local_user_settings_view_from_jwt_opt},
websocket::messages::GetUsersOnline,
LemmyContext,
}; };
use lemmy_db_schema::source::{actor_language::SiteLanguage, language::Language, tagline::Tagline}; use lemmy_db_schema::source::{actor_language::SiteLanguage, language::Language, tagline::Tagline};
use lemmy_db_views::structs::{LocalUserDiscussionLanguageView, SiteView}; use lemmy_db_views::structs::{LocalUserDiscussionLanguageView, SiteView};
@ -14,7 +16,6 @@ use lemmy_db_views_actor::structs::{
PersonViewSafe, PersonViewSafe,
}; };
use lemmy_utils::{error::LemmyError, version, ConnectionId}; use lemmy_utils::{error::LemmyError, version, ConnectionId};
use lemmy_websocket::{messages::GetUsersOnline, LemmyContext};
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl PerformCrud for GetSite { impl PerformCrud for GetSite {

View file

@ -9,6 +9,8 @@ use lemmy_api_common::{
local_site_to_slur_regex, local_site_to_slur_regex,
site_description_length_check, site_description_length_check,
}, },
websocket::{messages::SendAllMessage, UserOperationCrud},
LemmyContext,
}; };
use lemmy_db_schema::{ use lemmy_db_schema::{
source::{ source::{
@ -31,7 +33,6 @@ use lemmy_utils::{
utils::{check_application_question, check_slurs_opt}, utils::{check_application_question, check_slurs_opt},
ConnectionId, ConnectionId,
}; };
use lemmy_websocket::{messages::SendAllMessage, LemmyContext, UserOperationCrud};
use std::str::FromStr; use std::str::FromStr;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]

View file

@ -10,6 +10,8 @@ use lemmy_api_common::{
send_new_applicant_email_to_admins, send_new_applicant_email_to_admins,
send_verification_email, send_verification_email,
}, },
websocket::messages::CheckCaptcha,
LemmyContext,
}; };
use lemmy_apub::{ use lemmy_apub::{
generate_inbox_url, generate_inbox_url,
@ -33,7 +35,6 @@ use lemmy_utils::{
utils::{check_slurs, check_slurs_opt, is_valid_actor_name}, utils::{check_slurs, check_slurs_opt, is_valid_actor_name},
ConnectionId, ConnectionId,
}; };
use lemmy_websocket::{messages::CheckCaptcha, LemmyContext};
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl PerformCrud for Register { impl PerformCrud for Register {

View file

@ -4,10 +4,10 @@ use bcrypt::verify;
use lemmy_api_common::{ use lemmy_api_common::{
person::{DeleteAccount, DeleteAccountResponse}, person::{DeleteAccount, DeleteAccountResponse},
utils::{delete_user_account, get_local_user_view_from_jwt}, utils::{delete_user_account, get_local_user_view_from_jwt},
LemmyContext,
}; };
use lemmy_apub::protocol::activities::deletion::delete_user::DeleteUser; use lemmy_apub::protocol::activities::deletion::delete_user::DeleteUser;
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl PerformCrud for DeleteAccount { impl PerformCrud for DeleteAccount {

View file

@ -3,6 +3,7 @@ use actix_web::web::Data;
use lemmy_api_common::{ use lemmy_api_common::{
person::{GetPersonDetails, GetPersonDetailsResponse}, person::{GetPersonDetails, GetPersonDetailsResponse},
utils::{check_private_instance, get_local_user_view_from_jwt_opt}, utils::{check_private_instance, get_local_user_view_from_jwt_opt},
LemmyContext,
}; };
use lemmy_apub::{fetcher::resolve_actor_identifier, objects::person::ApubPerson}; use lemmy_apub::{fetcher::resolve_actor_identifier, objects::person::ApubPerson};
use lemmy_db_schema::{ use lemmy_db_schema::{
@ -12,7 +13,6 @@ use lemmy_db_schema::{
use lemmy_db_views::{comment_view::CommentQuery, post_view::PostQuery}; use lemmy_db_views::{comment_view::CommentQuery, post_view::PostQuery};
use lemmy_db_views_actor::structs::{CommunityModeratorView, PersonViewSafe}; use lemmy_db_views_actor::structs::{CommunityModeratorView, PersonViewSafe};
use lemmy_utils::{error::LemmyError, ConnectionId}; use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl PerformCrud for GetPersonDetails { impl PerformCrud for GetPersonDetails {

View file

@ -19,7 +19,6 @@ lemmy_db_schema = { workspace = true, features = ["full"] }
lemmy_db_views = { workspace = true, features = ["full"] } lemmy_db_views = { workspace = true, features = ["full"] }
lemmy_db_views_actor = { workspace = true, features = ["full"] } lemmy_db_views_actor = { workspace = true, features = ["full"] }
lemmy_api_common = { workspace = true, features = ["full"] } lemmy_api_common = { workspace = true, features = ["full"] }
lemmy_websocket = { workspace = true }
activitypub_federation = { workspace = true } activitypub_federation = { workspace = true }
diesel = { workspace = true } diesel = { workspace = true }
chrono = { workspace = true } chrono = { workspace = true }

View file

@ -23,7 +23,10 @@ use activitypub_federation::{
use activitystreams_kinds::{activity::BlockType, public}; use activitystreams_kinds::{activity::BlockType, public};
use anyhow::anyhow; use anyhow::anyhow;
use chrono::NaiveDateTime; use chrono::NaiveDateTime;
use lemmy_api_common::utils::{remove_user_data, remove_user_data_in_community}; use lemmy_api_common::{
utils::{remove_user_data, remove_user_data_in_community},
LemmyContext,
};
use lemmy_db_schema::{ use lemmy_db_schema::{
source::{ source::{
community::{ community::{
@ -38,7 +41,6 @@ use lemmy_db_schema::{
traits::{Bannable, Crud, Followable}, traits::{Bannable, Crud, Followable},
}; };
use lemmy_utils::{error::LemmyError, utils::convert_datetime}; use lemmy_utils::{error::LemmyError, utils::convert_datetime};
use lemmy_websocket::LemmyContext;
use url::Url; use url::Url;
impl BlockUser { impl BlockUser {

View file

@ -5,9 +5,9 @@ use crate::{
}; };
use activitypub_federation::{core::object_id::ObjectId, traits::ApubObject}; use activitypub_federation::{core::object_id::ObjectId, traits::ApubObject};
use chrono::NaiveDateTime; use chrono::NaiveDateTime;
use lemmy_api_common::LemmyContext;
use lemmy_db_schema::{source::site::Site, utils::DbPool}; use lemmy_db_schema::{source::site::Site, utils::DbPool};
use lemmy_utils::error::LemmyError; use lemmy_utils::error::LemmyError;
use lemmy_websocket::LemmyContext;
use serde::Deserialize; use serde::Deserialize;
use url::Url; use url::Url;

Some files were not shown because too many files have changed in this diff Show more