Merge websocket crate into api_common
This commit is contained in:
parent
70e3feb174
commit
030afbc2e7
170 changed files with 404 additions and 384 deletions
44
Cargo.lock
generated
44
Cargo.lock
generated
|
@ -2050,7 +2050,6 @@ dependencies = [
|
|||
"lemmy_db_views_actor",
|
||||
"lemmy_db_views_moderator",
|
||||
"lemmy_utils",
|
||||
"lemmy_websocket",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serial_test",
|
||||
|
@ -2063,8 +2062,12 @@ dependencies = [
|
|||
name = "lemmy_api_common"
|
||||
version = "0.16.5"
|
||||
dependencies = [
|
||||
"actix",
|
||||
"actix-rt",
|
||||
"actix-web",
|
||||
"actix-web-actors",
|
||||
"anyhow",
|
||||
"background-jobs",
|
||||
"chrono",
|
||||
"diesel",
|
||||
"encoding",
|
||||
|
@ -2073,13 +2076,20 @@ dependencies = [
|
|||
"lemmy_db_views_actor",
|
||||
"lemmy_db_views_moderator",
|
||||
"lemmy_utils",
|
||||
"opentelemetry 0.17.0",
|
||||
"percent-encoding",
|
||||
"rand 0.8.5",
|
||||
"regex",
|
||||
"reqwest",
|
||||
"reqwest-middleware",
|
||||
"rosetta-i18n",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"strum",
|
||||
"strum_macros",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"tracing-opentelemetry 0.17.4",
|
||||
"url",
|
||||
"webpage",
|
||||
]
|
||||
|
@ -2098,7 +2108,6 @@ dependencies = [
|
|||
"lemmy_db_views",
|
||||
"lemmy_db_views_actor",
|
||||
"lemmy_utils",
|
||||
"lemmy_websocket",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tracing",
|
||||
|
@ -2131,7 +2140,6 @@ dependencies = [
|
|||
"lemmy_db_views",
|
||||
"lemmy_db_views_actor",
|
||||
"lemmy_utils",
|
||||
"lemmy_websocket",
|
||||
"once_cell",
|
||||
"reqwest",
|
||||
"reqwest-middleware",
|
||||
|
@ -2228,7 +2236,6 @@ dependencies = [
|
|||
"lemmy_db_views",
|
||||
"lemmy_db_views_actor",
|
||||
"lemmy_utils",
|
||||
"lemmy_websocket",
|
||||
"once_cell",
|
||||
"reqwest",
|
||||
"reqwest-middleware",
|
||||
|
@ -2260,7 +2267,6 @@ dependencies = [
|
|||
"lemmy_db_schema",
|
||||
"lemmy_routes",
|
||||
"lemmy_utils",
|
||||
"lemmy_websocket",
|
||||
"opentelemetry 0.17.0",
|
||||
"opentelemetry-otlp",
|
||||
"parking_lot",
|
||||
|
@ -2317,34 +2323,6 @@ dependencies = [
|
|||
"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]]
|
||||
name = "lettre"
|
||||
version = "0.10.1"
|
||||
|
|
|
@ -45,7 +45,6 @@ members = [
|
|||
"crates/db_views",
|
||||
"crates/db_views_actor",
|
||||
"crates/db_views_actor",
|
||||
"crates/websocket",
|
||||
"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_db_schema = { version = "=0.16.5", path = "./crates/db_schema" }
|
||||
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_db_views = { version = "=0.16.5", path = "./crates/db_views" }
|
||||
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_db_schema = { workspace = true }
|
||||
lemmy_api_common = { workspace = true }
|
||||
lemmy_websocket = { workspace = true }
|
||||
lemmy_routes = { workspace = true }
|
||||
activitypub_federation = { workspace = true }
|
||||
diesel = { workspace = true }
|
||||
|
|
|
@ -21,7 +21,6 @@ lemmy_db_views = { workspace = true, features = ["full"] }
|
|||
lemmy_db_views_moderator = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_actor = { workspace = true, features = ["full"] }
|
||||
lemmy_api_common = { workspace = true, features = ["full"] }
|
||||
lemmy_websocket = { workspace = true }
|
||||
activitypub_federation = { workspace = true }
|
||||
diesel = { workspace = true }
|
||||
bcrypt = { workspace = true }
|
||||
|
|
|
@ -3,6 +3,8 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
comment::{CommentResponse, CreateCommentLike},
|
||||
utils::{check_community_ban, check_downvotes_enabled, get_local_user_view_from_jwt},
|
||||
websocket::{send::send_comment_ws_message, UserOperation},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_apub::{
|
||||
fetcher::post_or_comment::PostOrComment,
|
||||
|
@ -22,7 +24,6 @@ use lemmy_db_schema::{
|
|||
};
|
||||
use lemmy_db_views::structs::{CommentView, LocalUserView};
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::{send::send_comment_ws_message, LemmyContext, UserOperation};
|
||||
use std::convert::TryInto;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
|
|
|
@ -3,6 +3,7 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
comment::{CommentResponse, SaveComment},
|
||||
utils::get_local_user_view_from_jwt,
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_db_schema::{
|
||||
source::comment::{CommentSaved, CommentSavedForm},
|
||||
|
@ -10,7 +11,6 @@ use lemmy_db_schema::{
|
|||
};
|
||||
use lemmy_db_views::structs::CommentView;
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for SaveComment {
|
||||
|
|
|
@ -4,6 +4,8 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
comment::{CommentReportResponse, CreateCommentReport},
|
||||
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_db_schema::{
|
||||
|
@ -15,7 +17,6 @@ use lemmy_db_schema::{
|
|||
};
|
||||
use lemmy_db_views::structs::{CommentReportView, CommentView};
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::{messages::SendModRoomMessage, LemmyContext, UserOperation};
|
||||
|
||||
/// Creates a comment report and notifies the moderators of the community
|
||||
#[async_trait::async_trait(?Send)]
|
||||
|
|
|
@ -3,10 +3,10 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
comment::{ListCommentReports, ListCommentReportsResponse},
|
||||
utils::get_local_user_view_from_jwt,
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_db_views::comment_report_view::CommentReportQuery;
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
/// Lists comment reports for a community if an id is supplied
|
||||
/// or returns all comment reports for communities a user moderates
|
||||
|
|
|
@ -3,11 +3,12 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
comment::{CommentReportResponse, ResolveCommentReport},
|
||||
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_views::structs::CommentReportView;
|
||||
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
|
||||
#[async_trait::async_trait(?Send)]
|
||||
|
|
|
@ -3,6 +3,8 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
community::{AddModToCommunity, AddModToCommunityResponse},
|
||||
utils::{get_local_user_view_from_jwt, is_mod_or_admin},
|
||||
websocket::{messages::SendCommunityRoomMessage, UserOperation},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_apub::{
|
||||
objects::{community::ApubCommunity, person::ApubPerson},
|
||||
|
@ -18,7 +20,6 @@ use lemmy_db_schema::{
|
|||
};
|
||||
use lemmy_db_views_actor::structs::CommunityModeratorView;
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::{messages::SendCommunityRoomMessage, LemmyContext, UserOperation};
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for AddModToCommunity {
|
||||
|
|
|
@ -3,6 +3,8 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
community::{BanFromCommunity, BanFromCommunityResponse},
|
||||
utils::{get_local_user_view_from_jwt, is_mod_or_admin, remove_user_data_in_community},
|
||||
websocket::{messages::SendCommunityRoomMessage, UserOperation},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_apub::{
|
||||
activities::block::SiteOrCommunity,
|
||||
|
@ -25,7 +27,6 @@ use lemmy_db_schema::{
|
|||
};
|
||||
use lemmy_db_views_actor::structs::PersonViewSafe;
|
||||
use lemmy_utils::{error::LemmyError, utils::naive_from_unix, ConnectionId};
|
||||
use lemmy_websocket::{messages::SendCommunityRoomMessage, LemmyContext, UserOperation};
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for BanFromCommunity {
|
||||
|
|
|
@ -3,6 +3,7 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
community::{BlockCommunity, BlockCommunityResponse},
|
||||
utils::get_local_user_view_from_jwt,
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_apub::protocol::activities::following::undo_follow::UndoFollow;
|
||||
use lemmy_db_schema::{
|
||||
|
@ -14,7 +15,6 @@ use lemmy_db_schema::{
|
|||
};
|
||||
use lemmy_db_views_actor::structs::CommunityView;
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for BlockCommunity {
|
||||
|
|
|
@ -3,6 +3,7 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
community::{CommunityResponse, FollowCommunity},
|
||||
utils::{check_community_ban, check_community_deleted_or_removed, get_local_user_view_from_jwt},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_apub::{
|
||||
objects::community::ApubCommunity,
|
||||
|
@ -17,7 +18,6 @@ use lemmy_db_schema::{
|
|||
};
|
||||
use lemmy_db_views_actor::structs::CommunityView;
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for FollowCommunity {
|
||||
|
|
|
@ -3,6 +3,8 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
community::{CommunityResponse, HideCommunity},
|
||||
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_db_schema::{
|
||||
|
@ -13,7 +15,6 @@ use lemmy_db_schema::{
|
|||
traits::Crud,
|
||||
};
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::{send::send_community_ws_message, LemmyContext, UserOperationCrud};
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for HideCommunity {
|
||||
|
|
|
@ -4,6 +4,7 @@ use anyhow::Context;
|
|||
use lemmy_api_common::{
|
||||
community::{GetCommunityResponse, TransferCommunity},
|
||||
utils::get_local_user_view_from_jwt,
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_db_schema::{
|
||||
source::{
|
||||
|
@ -14,7 +15,6 @@ use lemmy_db_schema::{
|
|||
};
|
||||
use lemmy_db_views_actor::structs::{CommunityModeratorView, CommunityView, PersonViewSafe};
|
||||
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
|
||||
// gets fetched. i hope we can get rid of the community creator role soon.
|
||||
|
|
|
@ -66,11 +66,15 @@ use lemmy_api_common::{
|
|||
Search,
|
||||
},
|
||||
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_utils::{error::LemmyError, utils::check_slurs, ConnectionId};
|
||||
use lemmy_websocket::{serialize_websocket_message, LemmyContext, UserOperation};
|
||||
use serde::Deserialize;
|
||||
|
||||
mod comment;
|
||||
|
|
|
@ -3,6 +3,8 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
person::{AddAdmin, AddAdminResponse},
|
||||
utils::{get_local_user_view_from_jwt, is_admin},
|
||||
websocket::{messages::SendAllMessage, UserOperation},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_db_schema::{
|
||||
source::{
|
||||
|
@ -13,7 +15,6 @@ use lemmy_db_schema::{
|
|||
};
|
||||
use lemmy_db_views_actor::structs::PersonViewSafe;
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::{messages::SendAllMessage, LemmyContext, UserOperation};
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for AddAdmin {
|
||||
|
|
|
@ -3,6 +3,8 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
person::{BanPerson, BanPersonResponse},
|
||||
utils::{get_local_user_view_from_jwt, is_admin, remove_user_data},
|
||||
websocket::{messages::SendAllMessage, UserOperation},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_apub::{
|
||||
activities::block::SiteOrCommunity,
|
||||
|
@ -18,7 +20,6 @@ use lemmy_db_schema::{
|
|||
use lemmy_db_views::structs::SiteView;
|
||||
use lemmy_db_views_actor::structs::PersonViewSafe;
|
||||
use lemmy_utils::{error::LemmyError, utils::naive_from_unix, ConnectionId};
|
||||
use lemmy_websocket::{messages::SendAllMessage, LemmyContext, UserOperation};
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for BanPerson {
|
||||
|
|
|
@ -3,6 +3,7 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
person::{BlockPerson, BlockPersonResponse},
|
||||
utils::get_local_user_view_from_jwt,
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_db_schema::{
|
||||
source::person_block::{PersonBlock, PersonBlockForm},
|
||||
|
@ -10,7 +11,6 @@ use lemmy_db_schema::{
|
|||
};
|
||||
use lemmy_db_views_actor::structs::PersonViewSafe;
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for BlockPerson {
|
||||
|
|
|
@ -4,10 +4,10 @@ use bcrypt::verify;
|
|||
use lemmy_api_common::{
|
||||
person::{ChangePassword, LoginResponse},
|
||||
utils::{get_local_user_view_from_jwt, password_length_check},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_db_schema::source::local_user::LocalUser;
|
||||
use lemmy_utils::{claims::Claims, error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for ChangePassword {
|
||||
|
|
|
@ -3,6 +3,7 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
person::{LoginResponse, PasswordChangeAfterReset},
|
||||
utils::password_length_check,
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_db_schema::source::{
|
||||
local_user::LocalUser,
|
||||
|
@ -10,7 +11,6 @@ use lemmy_db_schema::source::{
|
|||
};
|
||||
use lemmy_db_views::structs::SiteView;
|
||||
use lemmy_utils::{claims::Claims, error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for PasswordChangeAfterReset {
|
||||
|
|
|
@ -2,10 +2,13 @@ use crate::{captcha_as_wav_base64, Perform};
|
|||
use actix_web::web::Data;
|
||||
use captcha::{gen, Difficulty};
|
||||
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_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::{messages::CaptchaItem, LemmyContext};
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for GetCaptcha {
|
||||
|
|
|
@ -3,10 +3,10 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
person::{BannedPersonsResponse, GetBannedPersons},
|
||||
utils::{get_local_user_view_from_jwt, is_admin},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_db_views_actor::structs::PersonViewSafe;
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for GetBannedPersons {
|
||||
|
|
|
@ -4,11 +4,11 @@ use bcrypt::verify;
|
|||
use lemmy_api_common::{
|
||||
person::{Login, LoginResponse},
|
||||
utils::{check_registration_application, check_user_valid},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_db_schema::source::local_site::LocalSite;
|
||||
use lemmy_db_views::structs::LocalUserView;
|
||||
use lemmy_utils::{claims::Claims, error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for Login {
|
||||
|
|
|
@ -3,10 +3,10 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
person::{GetPersonMentions, GetPersonMentionsResponse},
|
||||
utils::get_local_user_view_from_jwt,
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_db_views_actor::person_mention_view::PersonMentionQuery;
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for GetPersonMentions {
|
||||
|
|
|
@ -3,10 +3,10 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
person::{GetReplies, GetRepliesResponse},
|
||||
utils::get_local_user_view_from_jwt,
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_db_views_actor::comment_reply_view::CommentReplyQuery;
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for GetReplies {
|
||||
|
|
|
@ -3,6 +3,7 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
person::{GetRepliesResponse, MarkAllAsRead},
|
||||
utils::get_local_user_view_from_jwt,
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_db_schema::source::{
|
||||
comment_reply::CommentReply,
|
||||
|
@ -10,7 +11,6 @@ use lemmy_db_schema::source::{
|
|||
private_message::PrivateMessage,
|
||||
};
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for MarkAllAsRead {
|
||||
|
|
|
@ -3,6 +3,7 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
person::{MarkPersonMentionAsRead, PersonMentionResponse},
|
||||
utils::get_local_user_view_from_jwt,
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_db_schema::{
|
||||
source::person_mention::{PersonMention, PersonMentionUpdateForm},
|
||||
|
@ -10,7 +11,6 @@ use lemmy_db_schema::{
|
|||
};
|
||||
use lemmy_db_views_actor::structs::PersonMentionView;
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for MarkPersonMentionAsRead {
|
||||
|
|
|
@ -3,6 +3,7 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
person::{CommentReplyResponse, MarkCommentReplyAsRead},
|
||||
utils::get_local_user_view_from_jwt,
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_db_schema::{
|
||||
source::comment_reply::{CommentReply, CommentReplyUpdateForm},
|
||||
|
@ -10,7 +11,6 @@ use lemmy_db_schema::{
|
|||
};
|
||||
use lemmy_db_views_actor::structs::CommentReplyView;
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for MarkCommentReplyAsRead {
|
||||
|
|
|
@ -3,11 +3,11 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
person::{GetUnreadCount, GetUnreadCountResponse},
|
||||
utils::get_local_user_view_from_jwt,
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_db_views::structs::PrivateMessageView;
|
||||
use lemmy_db_views_actor::structs::{CommentReplyView, PersonMentionView};
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for GetUnreadCount {
|
||||
|
|
|
@ -3,10 +3,10 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
person::{GetReportCount, GetReportCountResponse},
|
||||
utils::get_local_user_view_from_jwt,
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_db_views::structs::{CommentReportView, PostReportView, PrivateMessageReportView};
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for GetReportCount {
|
||||
|
|
|
@ -3,10 +3,10 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
person::{PasswordReset, PasswordResetResponse},
|
||||
utils::send_password_reset_email,
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_db_views::structs::LocalUserView;
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for PasswordReset {
|
||||
|
|
|
@ -3,6 +3,7 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
person::{LoginResponse, SaveUserSettings},
|
||||
utils::{get_local_user_view_from_jwt, send_verification_email},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_db_schema::{
|
||||
source::{
|
||||
|
@ -20,7 +21,6 @@ use lemmy_utils::{
|
|||
utils::{is_valid_display_name, is_valid_matrix_id},
|
||||
ConnectionId,
|
||||
};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for SaveUserSettings {
|
||||
|
|
|
@ -3,6 +3,7 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
person::{VerifyEmail, VerifyEmailResponse},
|
||||
utils::send_email_verification_success,
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_db_schema::{
|
||||
source::{
|
||||
|
@ -13,7 +14,6 @@ use lemmy_db_schema::{
|
|||
};
|
||||
use lemmy_db_views::structs::LocalUserView;
|
||||
use lemmy_utils::error::LemmyError;
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for VerifyEmail {
|
||||
|
|
|
@ -3,9 +3,9 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
post::{GetSiteMetadata, GetSiteMetadataResponse},
|
||||
request::fetch_site_metadata,
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for GetSiteMetadata {
|
||||
|
|
|
@ -9,6 +9,8 @@ use lemmy_api_common::{
|
|||
get_local_user_view_from_jwt,
|
||||
mark_post_as_read,
|
||||
},
|
||||
websocket::{send::send_post_ws_message, UserOperation},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_apub::{
|
||||
fetcher::post_or_comment::PostOrComment,
|
||||
|
@ -26,7 +28,6 @@ use lemmy_db_schema::{
|
|||
traits::{Crud, Likeable},
|
||||
};
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::{send::send_post_ws_message, LemmyContext, UserOperation};
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for CreatePostLike {
|
||||
|
|
|
@ -8,6 +8,8 @@ use lemmy_api_common::{
|
|||
get_local_user_view_from_jwt,
|
||||
is_mod_or_admin,
|
||||
},
|
||||
websocket::{send::send_post_ws_message, UserOperation},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_apub::{
|
||||
objects::post::ApubPost,
|
||||
|
@ -21,7 +23,6 @@ use lemmy_db_schema::{
|
|||
traits::Crud,
|
||||
};
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::{send::send_post_ws_message, LemmyContext, UserOperation};
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for LockPost {
|
||||
|
|
|
@ -3,10 +3,10 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
post::{MarkPostAsRead, PostResponse},
|
||||
utils::{get_local_user_view_from_jwt, mark_post_as_read, mark_post_as_unread},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_db_views::structs::PostView;
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for MarkPostAsRead {
|
||||
|
|
|
@ -3,6 +3,7 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
post::{PostResponse, SavePost},
|
||||
utils::{get_local_user_view_from_jwt, mark_post_as_read},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_db_schema::{
|
||||
source::post::{PostSaved, PostSavedForm},
|
||||
|
@ -10,7 +11,6 @@ use lemmy_db_schema::{
|
|||
};
|
||||
use lemmy_db_views::structs::PostView;
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for SavePost {
|
||||
|
|
|
@ -8,6 +8,8 @@ use lemmy_api_common::{
|
|||
get_local_user_view_from_jwt,
|
||||
is_mod_or_admin,
|
||||
},
|
||||
websocket::{send::send_post_ws_message, UserOperation},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_apub::{
|
||||
objects::post::ApubPost,
|
||||
|
@ -21,7 +23,6 @@ use lemmy_db_schema::{
|
|||
traits::Crud,
|
||||
};
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::{send::send_post_ws_message, LemmyContext, UserOperation};
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for StickyPost {
|
||||
|
|
|
@ -4,6 +4,8 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
post::{CreatePostReport, PostReportResponse},
|
||||
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_db_schema::{
|
||||
|
@ -15,7 +17,6 @@ use lemmy_db_schema::{
|
|||
};
|
||||
use lemmy_db_views::structs::{PostReportView, PostView};
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::{messages::SendModRoomMessage, LemmyContext, UserOperation};
|
||||
|
||||
/// Creates a post report and notifies the moderators of the community
|
||||
#[async_trait::async_trait(?Send)]
|
||||
|
|
|
@ -3,10 +3,10 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
post::{ListPostReports, ListPostReportsResponse},
|
||||
utils::get_local_user_view_from_jwt,
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_db_views::post_report_view::PostReportQuery;
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
/// Lists post reports for a community if an id is supplied
|
||||
/// or returns all post reports for communities a user moderates
|
||||
|
|
|
@ -3,11 +3,12 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
post::{PostReportResponse, ResolvePostReport},
|
||||
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_views::structs::PostReportView;
|
||||
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
|
||||
#[async_trait::async_trait(?Send)]
|
||||
|
|
|
@ -3,13 +3,14 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
private_message::{MarkPrivateMessageAsRead, PrivateMessageResponse},
|
||||
utils::get_local_user_view_from_jwt,
|
||||
websocket::{send::send_pm_ws_message, UserOperation},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_db_schema::{
|
||||
source::private_message::{PrivateMessage, PrivateMessageUpdateForm},
|
||||
traits::Crud,
|
||||
};
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::{send::send_pm_ws_message, LemmyContext, UserOperation};
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for MarkPrivateMessageAsRead {
|
||||
|
|
|
@ -3,6 +3,8 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
private_message::{CreatePrivateMessageReport, PrivateMessageReportResponse},
|
||||
utils::get_local_user_view_from_jwt,
|
||||
websocket::{messages::SendModRoomMessage, UserOperation},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_db_schema::{
|
||||
newtypes::CommunityId,
|
||||
|
@ -15,7 +17,6 @@ use lemmy_db_schema::{
|
|||
};
|
||||
use lemmy_db_views::structs::PrivateMessageReportView;
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::{messages::SendModRoomMessage, LemmyContext, UserOperation};
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for CreatePrivateMessageReport {
|
||||
|
|
|
@ -3,10 +3,10 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
private_message::{ListPrivateMessageReports, ListPrivateMessageReportsResponse},
|
||||
utils::{get_local_user_view_from_jwt, is_admin},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_db_views::private_message_report_view::PrivateMessageReportQuery;
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for ListPrivateMessageReports {
|
||||
|
|
|
@ -3,6 +3,8 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
private_message::{PrivateMessageReportResponse, ResolvePrivateMessageReport},
|
||||
utils::{get_local_user_view_from_jwt, is_admin},
|
||||
websocket::{messages::SendModRoomMessage, UserOperation},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_db_schema::{
|
||||
newtypes::CommunityId,
|
||||
|
@ -11,7 +13,6 @@ use lemmy_db_schema::{
|
|||
};
|
||||
use lemmy_db_views::structs::PrivateMessageReportView;
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::{messages::SendModRoomMessage, LemmyContext, UserOperation};
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for ResolvePrivateMessageReport {
|
||||
|
|
|
@ -3,6 +3,7 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
site::{GetSiteResponse, LeaveAdmin},
|
||||
utils::{get_local_user_view_from_jwt, is_admin},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_db_schema::{
|
||||
source::{
|
||||
|
@ -17,7 +18,6 @@ use lemmy_db_schema::{
|
|||
use lemmy_db_views::structs::SiteView;
|
||||
use lemmy_db_views_actor::structs::PersonViewSafe;
|
||||
use lemmy_utils::{error::LemmyError, version, ConnectionId};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for LeaveAdmin {
|
||||
|
|
|
@ -3,6 +3,7 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
site::{GetModlog, GetModlogResponse},
|
||||
utils::{check_private_instance, get_local_user_view_from_jwt_opt, is_admin, is_mod_or_admin},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_db_schema::{
|
||||
newtypes::{CommunityId, PersonId},
|
||||
|
@ -28,7 +29,6 @@ use lemmy_db_views_moderator::structs::{
|
|||
ModlogListParams,
|
||||
};
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
use ModlogActionType::*;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
|
|
|
@ -3,6 +3,7 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
site::{PurgeComment, PurgeItemResponse},
|
||||
utils::{get_local_user_view_from_jwt, is_admin},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_db_schema::{
|
||||
source::{
|
||||
|
@ -12,7 +13,6 @@ use lemmy_db_schema::{
|
|||
traits::Crud,
|
||||
};
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for PurgeComment {
|
||||
|
|
|
@ -4,6 +4,7 @@ use lemmy_api_common::{
|
|||
request::purge_image_from_pictrs,
|
||||
site::{PurgeCommunity, PurgeItemResponse},
|
||||
utils::{get_local_user_view_from_jwt, is_admin, purge_image_posts_for_community},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_db_schema::{
|
||||
source::{
|
||||
|
@ -13,7 +14,6 @@ use lemmy_db_schema::{
|
|||
traits::Crud,
|
||||
};
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for PurgeCommunity {
|
||||
|
|
|
@ -4,6 +4,7 @@ use lemmy_api_common::{
|
|||
request::purge_image_from_pictrs,
|
||||
site::{PurgeItemResponse, PurgePerson},
|
||||
utils::{get_local_user_view_from_jwt, is_admin, purge_image_posts_for_person},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_db_schema::{
|
||||
source::{
|
||||
|
@ -13,7 +14,6 @@ use lemmy_db_schema::{
|
|||
traits::Crud,
|
||||
};
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for PurgePerson {
|
||||
|
|
|
@ -4,6 +4,7 @@ use lemmy_api_common::{
|
|||
request::purge_image_from_pictrs,
|
||||
site::{PurgeItemResponse, PurgePost},
|
||||
utils::{get_local_user_view_from_jwt, is_admin},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_db_schema::{
|
||||
source::{
|
||||
|
@ -13,7 +14,6 @@ use lemmy_db_schema::{
|
|||
traits::Crud,
|
||||
};
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for PurgePost {
|
||||
|
|
|
@ -3,6 +3,7 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
site::{ApproveRegistrationApplication, RegistrationApplicationResponse},
|
||||
utils::{get_local_user_view_from_jwt, is_admin, send_application_approved_email},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_db_schema::{
|
||||
source::{
|
||||
|
@ -14,7 +15,6 @@ use lemmy_db_schema::{
|
|||
};
|
||||
use lemmy_db_views::structs::{LocalUserView, RegistrationApplicationView};
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for ApproveRegistrationApplication {
|
||||
|
|
|
@ -3,11 +3,11 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
site::{ListRegistrationApplications, ListRegistrationApplicationsResponse},
|
||||
utils::{get_local_user_view_from_jwt, is_admin},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_db_schema::source::local_site::LocalSite;
|
||||
use lemmy_db_views::registration_application_view::RegistrationApplicationQuery;
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
/// Lists registration applications, filterable by undenied only.
|
||||
#[async_trait::async_trait(?Send)]
|
||||
|
|
|
@ -3,11 +3,11 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
site::{GetUnreadRegistrationApplicationCount, GetUnreadRegistrationApplicationCountResponse},
|
||||
utils::{get_local_user_view_from_jwt, is_admin},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_db_schema::source::local_site::LocalSite;
|
||||
use lemmy_db_views::structs::RegistrationApplicationView;
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for GetUnreadRegistrationApplicationCount {
|
||||
|
|
|
@ -4,13 +4,13 @@ use diesel::NotFound;
|
|||
use lemmy_api_common::{
|
||||
site::{ResolveObject, ResolveObjectResponse},
|
||||
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_db_schema::{newtypes::PersonId, source::local_site::LocalSite, utils::DbPool};
|
||||
use lemmy_db_views::structs::{CommentView, PostView};
|
||||
use lemmy_db_views_actor::structs::{CommunityView, PersonViewSafe};
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for ResolveObject {
|
||||
|
|
|
@ -3,6 +3,7 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
site::{Search, SearchResponse},
|
||||
utils::{check_private_instance, get_local_user_view_from_jwt_opt},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_apub::{fetcher::resolve_actor_identifier, objects::community::ApubCommunity};
|
||||
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_actor::{community_view::CommunityQuery, person_view::PersonQuery};
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for Search {
|
||||
|
|
|
@ -3,6 +3,8 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
utils::get_local_user_view_from_jwt,
|
||||
websocket::{
|
||||
messages::{JoinCommunityRoom, JoinModRoom, JoinPostRoom, JoinUserRoom},
|
||||
structs::{
|
||||
CommunityJoin,
|
||||
CommunityJoinResponse,
|
||||
ModJoin,
|
||||
|
@ -12,12 +14,10 @@ use lemmy_api_common::{
|
|||
UserJoin,
|
||||
UserJoinResponse,
|
||||
},
|
||||
};
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::{
|
||||
messages::{JoinCommunityRoom, JoinModRoom, JoinPostRoom, JoinUserRoom},
|
||||
},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl Perform for UserJoin {
|
||||
|
|
|
@ -36,6 +36,17 @@ rosetta-i18n = { workspace = true, optional = true }
|
|||
percent-encoding = { workspace = true, optional = true }
|
||||
webpage = { version = "1.4.0", default-features = false, features = ["serde"], 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]
|
||||
actix-rt = { workspace = true }
|
||||
|
|
|
@ -11,7 +11,78 @@ pub mod site;
|
|||
pub mod utils;
|
||||
pub mod websocket;
|
||||
|
||||
#[macro_use]
|
||||
extern crate strum_macros;
|
||||
pub extern crate lemmy_db_schema;
|
||||
pub extern crate lemmy_db_views;
|
||||
pub extern crate lemmy_db_views_actor;
|
||||
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(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
use crate::{
|
||||
comment::CommentResponse,
|
||||
post::PostResponse,
|
||||
websocket::{
|
||||
messages::{CaptchaItem, StandardMessage, WsMessage},
|
||||
serialize_websocket_message,
|
||||
LemmyContext,
|
||||
OperationType,
|
||||
UserOperation,
|
||||
UserOperationCrud,
|
||||
},
|
||||
LemmyContext,
|
||||
};
|
||||
use actix::prelude::*;
|
||||
use anyhow::Context as acontext;
|
||||
use lemmy_api_common::{comment::CommentResponse, post::PostResponse};
|
||||
use lemmy_db_schema::{
|
||||
newtypes::{CommunityId, LocalUserId, PostId},
|
||||
source::secret::Secret,
|
|
@ -1,4 +1,4 @@
|
|||
use crate::{
|
||||
use crate::websocket::{
|
||||
chat_server::{ChatServer, SessionInfo},
|
||||
messages::{
|
||||
CaptchaItem,
|
|
@ -1,6 +1,5 @@
|
|||
use crate::UserOperation;
|
||||
use crate::{comment::CommentResponse, post::PostResponse, websocket::UserOperation};
|
||||
use actix::{prelude::*, Recipient};
|
||||
use lemmy_api_common::{comment::CommentResponse, post::PostResponse};
|
||||
use lemmy_db_schema::newtypes::{CommunityId, LocalUserId, PostId};
|
||||
use lemmy_utils::{ConnectionId, IpAddr};
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,15 +1,4 @@
|
|||
#[macro_use]
|
||||
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 lemmy_utils::error::LemmyError;
|
||||
use serde::Serialize;
|
||||
|
||||
pub mod chat_server;
|
||||
|
@ -17,66 +6,7 @@ pub mod handlers;
|
|||
pub mod messages;
|
||||
pub mod routes;
|
||||
pub mod send;
|
||||
|
||||
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(),
|
||||
}
|
||||
}
|
||||
}
|
||||
pub mod structs;
|
||||
|
||||
#[derive(Serialize)]
|
||||
struct WebsocketResponse<T> {
|
|
@ -1,6 +1,8 @@
|
|||
use crate::{
|
||||
websocket::{
|
||||
chat_server::ChatServer,
|
||||
messages::{Connect, Disconnect, StandardMessage, WsMessage},
|
||||
},
|
||||
LemmyContext,
|
||||
};
|
||||
use actix::prelude::*;
|
|
@ -1,14 +1,14 @@
|
|||
use crate::{
|
||||
messages::{SendComment, SendCommunityRoomMessage, SendPost, SendUserRoomMessage},
|
||||
LemmyContext,
|
||||
OperationType,
|
||||
};
|
||||
use lemmy_api_common::{
|
||||
comment::CommentResponse,
|
||||
community::CommunityResponse,
|
||||
post::PostResponse,
|
||||
private_message::PrivateMessageResponse,
|
||||
utils::{check_person_block, get_interface_language, send_email_to_user},
|
||||
websocket::{
|
||||
messages::{SendComment, SendCommunityRoomMessage, SendPost, SendUserRoomMessage},
|
||||
OperationType,
|
||||
},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_db_schema::{
|
||||
newtypes::{CommentId, CommunityId, LocalUserId, PersonId, PostId, PrivateMessageId},
|
|
@ -15,7 +15,6 @@ lemmy_db_schema = { workspace = true, features = ["full"] }
|
|||
lemmy_db_views = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_actor = { workspace = true, features = ["full"] }
|
||||
lemmy_api_common = { workspace = true, features = ["full"] }
|
||||
lemmy_websocket = { workspace = true }
|
||||
activitypub_federation = { workspace = true }
|
||||
bcrypt = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
|
|
|
@ -10,6 +10,11 @@ use lemmy_api_common::{
|
|||
get_post,
|
||||
local_site_to_slur_regex,
|
||||
},
|
||||
websocket::{
|
||||
send::{send_comment_ws_message, send_local_notifs},
|
||||
UserOperationCrud,
|
||||
},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_apub::{
|
||||
generate_local_apub_endpoint,
|
||||
|
@ -32,11 +37,6 @@ use lemmy_utils::{
|
|||
utils::{remove_slurs, scrape_text_for_mentions},
|
||||
ConnectionId,
|
||||
};
|
||||
use lemmy_websocket::{
|
||||
send::{send_comment_ws_message, send_local_notifs},
|
||||
LemmyContext,
|
||||
UserOperationCrud,
|
||||
};
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl PerformCrud for CreateComment {
|
||||
|
|
|
@ -3,6 +3,11 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
comment::{CommentResponse, DeleteComment},
|
||||
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_db_schema::{
|
||||
|
@ -15,11 +20,6 @@ use lemmy_db_schema::{
|
|||
};
|
||||
use lemmy_db_views::structs::CommentView;
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::{
|
||||
send::{send_comment_ws_message, send_local_notifs},
|
||||
LemmyContext,
|
||||
UserOperationCrud,
|
||||
};
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl PerformCrud for DeleteComment {
|
||||
|
|
|
@ -7,6 +7,7 @@ use lemmy_api_common::{
|
|||
get_local_user_view_from_jwt_opt,
|
||||
listing_type_with_site_default,
|
||||
},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_apub::{fetcher::resolve_actor_identifier, objects::community::ApubCommunity};
|
||||
use lemmy_db_schema::{
|
||||
|
@ -15,7 +16,6 @@ use lemmy_db_schema::{
|
|||
};
|
||||
use lemmy_db_views::comment_view::CommentQuery;
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl PerformCrud for GetComments {
|
||||
|
|
|
@ -3,11 +3,11 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
comment::{CommentResponse, GetComment},
|
||||
utils::{check_private_instance, get_local_user_view_from_jwt_opt},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_db_schema::source::local_site::LocalSite;
|
||||
use lemmy_db_views::structs::CommentView;
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl PerformCrud for GetComment {
|
||||
|
|
|
@ -3,6 +3,11 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
comment::{CommentResponse, RemoveComment},
|
||||
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_db_schema::{
|
||||
|
@ -16,11 +21,6 @@ use lemmy_db_schema::{
|
|||
};
|
||||
use lemmy_db_views::structs::CommentView;
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::{
|
||||
send::{send_comment_ws_message, send_local_notifs},
|
||||
LemmyContext,
|
||||
UserOperationCrud,
|
||||
};
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl PerformCrud for RemoveComment {
|
||||
|
|
|
@ -10,6 +10,11 @@ use lemmy_api_common::{
|
|||
is_mod_or_admin,
|
||||
local_site_to_slur_regex,
|
||||
},
|
||||
websocket::{
|
||||
send::{send_comment_ws_message, send_local_notifs},
|
||||
UserOperationCrud,
|
||||
},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_apub::protocol::activities::{
|
||||
create_or_update::note::CreateOrUpdateNote,
|
||||
|
@ -29,11 +34,6 @@ use lemmy_utils::{
|
|||
utils::{remove_slurs, scrape_text_for_mentions},
|
||||
ConnectionId,
|
||||
};
|
||||
use lemmy_websocket::{
|
||||
send::{send_comment_ws_message, send_local_notifs},
|
||||
LemmyContext,
|
||||
UserOperationCrud,
|
||||
};
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl PerformCrud for EditComment {
|
||||
|
|
|
@ -4,6 +4,7 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
community::{CommunityResponse, CreateCommunity},
|
||||
utils::{get_local_user_view_from_jwt, is_admin, local_site_to_slur_regex},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_apub::{
|
||||
generate_followers_url,
|
||||
|
@ -32,7 +33,6 @@ use lemmy_utils::{
|
|||
utils::{check_slurs, check_slurs_opt, is_valid_actor_name},
|
||||
ConnectionId,
|
||||
};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl PerformCrud for CreateCommunity {
|
||||
|
|
|
@ -3,6 +3,8 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
community::{CommunityResponse, DeleteCommunity},
|
||||
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_db_schema::{
|
||||
|
@ -11,7 +13,6 @@ use lemmy_db_schema::{
|
|||
};
|
||||
use lemmy_db_views_actor::structs::CommunityModeratorView;
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::{send::send_community_ws_message, LemmyContext, UserOperationCrud};
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl PerformCrud for DeleteCommunity {
|
||||
|
|
|
@ -3,11 +3,11 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
community::{ListCommunities, ListCommunitiesResponse},
|
||||
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_views_actor::community_view::CommunityQuery;
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl PerformCrud for ListCommunities {
|
||||
|
|
|
@ -3,6 +3,8 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
community::{GetCommunity, GetCommunityResponse},
|
||||
utils::{check_private_instance, get_local_user_view_from_jwt_opt},
|
||||
websocket::messages::GetCommunityUsersOnline,
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_apub::{
|
||||
fetcher::resolve_actor_identifier,
|
||||
|
@ -20,7 +22,6 @@ use lemmy_db_schema::{
|
|||
};
|
||||
use lemmy_db_views_actor::structs::{CommunityModeratorView, CommunityView};
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::{messages::GetCommunityUsersOnline, LemmyContext};
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl PerformCrud for GetCommunity {
|
||||
|
|
|
@ -3,6 +3,8 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
community::{CommunityResponse, RemoveCommunity},
|
||||
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_db_schema::{
|
||||
|
@ -13,7 +15,6 @@ use lemmy_db_schema::{
|
|||
traits::Crud,
|
||||
};
|
||||
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)]
|
||||
impl PerformCrud for RemoveCommunity {
|
||||
|
|
|
@ -3,6 +3,8 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
community::{CommunityResponse, EditCommunity},
|
||||
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_db_schema::{
|
||||
|
@ -17,7 +19,6 @@ use lemmy_db_schema::{
|
|||
};
|
||||
use lemmy_db_views_actor::structs::CommunityModeratorView;
|
||||
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)]
|
||||
impl PerformCrud for EditCommunity {
|
||||
|
|
|
@ -18,9 +18,10 @@ use lemmy_api_common::{
|
|||
GetPrivateMessages,
|
||||
},
|
||||
site::{CreateSite, EditSite, GetSite},
|
||||
websocket::{serialize_websocket_message, UserOperationCrud},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::{serialize_websocket_message, LemmyContext, UserOperationCrud};
|
||||
use serde::Deserialize;
|
||||
|
||||
mod comment;
|
||||
|
|
|
@ -11,6 +11,8 @@ use lemmy_api_common::{
|
|||
local_site_to_slur_regex,
|
||||
mark_post_as_read,
|
||||
},
|
||||
websocket::{send::send_post_ws_message, UserOperationCrud},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_apub::{
|
||||
generate_local_apub_endpoint,
|
||||
|
@ -34,7 +36,6 @@ use lemmy_utils::{
|
|||
utils::{check_slurs, check_slurs_opt, clean_url_params, is_valid_post_title},
|
||||
ConnectionId,
|
||||
};
|
||||
use lemmy_websocket::{send::send_post_ws_message, LemmyContext, UserOperationCrud};
|
||||
use tracing::{warn, Instrument};
|
||||
use url::Url;
|
||||
use webmention::{Webmention, WebmentionError};
|
||||
|
|
|
@ -3,6 +3,8 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
post::{DeletePost, PostResponse},
|
||||
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_db_schema::{
|
||||
|
@ -13,7 +15,6 @@ use lemmy_db_schema::{
|
|||
traits::Crud,
|
||||
};
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::{send::send_post_ws_message, LemmyContext, UserOperationCrud};
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl PerformCrud for DeletePost {
|
||||
|
|
|
@ -7,6 +7,7 @@ use lemmy_api_common::{
|
|||
get_local_user_view_from_jwt_opt,
|
||||
listing_type_with_site_default,
|
||||
},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_apub::{fetcher::resolve_actor_identifier, objects::community::ApubCommunity};
|
||||
use lemmy_db_schema::{
|
||||
|
@ -15,7 +16,6 @@ use lemmy_db_schema::{
|
|||
};
|
||||
use lemmy_db_views::post_view::PostQuery;
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl PerformCrud for GetPosts {
|
||||
|
|
|
@ -3,6 +3,8 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
post::{GetPost, GetPostResponse},
|
||||
utils::{check_private_instance, get_local_user_view_from_jwt_opt, mark_post_as_read},
|
||||
websocket::messages::GetPostUsersOnline,
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_db_schema::{
|
||||
aggregates::structs::{PersonPostAggregates, PersonPostAggregatesForm},
|
||||
|
@ -12,7 +14,6 @@ use lemmy_db_schema::{
|
|||
use lemmy_db_views::structs::PostView;
|
||||
use lemmy_db_views_actor::structs::{CommunityModeratorView, CommunityView};
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::{messages::GetPostUsersOnline, LemmyContext};
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl PerformCrud for GetPost {
|
||||
|
|
|
@ -3,6 +3,8 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
post::{PostResponse, RemovePost},
|
||||
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_db_schema::{
|
||||
|
@ -14,7 +16,6 @@ use lemmy_db_schema::{
|
|||
traits::Crud,
|
||||
};
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::{send::send_post_ws_message, LemmyContext, UserOperationCrud};
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl PerformCrud for RemovePost {
|
||||
|
|
|
@ -9,6 +9,8 @@ use lemmy_api_common::{
|
|||
get_local_user_view_from_jwt,
|
||||
local_site_to_slur_regex,
|
||||
},
|
||||
websocket::{send::send_post_ws_message, UserOperationCrud},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_apub::protocol::activities::{
|
||||
create_or_update::page::CreateOrUpdatePage,
|
||||
|
@ -28,7 +30,6 @@ use lemmy_utils::{
|
|||
utils::{check_slurs_opt, clean_url_params, is_valid_post_title},
|
||||
ConnectionId,
|
||||
};
|
||||
use lemmy_websocket::{send::send_post_ws_message, LemmyContext, UserOperationCrud};
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl PerformCrud for EditPost {
|
||||
|
|
|
@ -9,6 +9,8 @@ use lemmy_api_common::{
|
|||
local_site_to_slur_regex,
|
||||
send_email_to_user,
|
||||
},
|
||||
websocket::{send::send_pm_ws_message, UserOperationCrud},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_apub::{
|
||||
generate_local_apub_endpoint,
|
||||
|
@ -27,7 +29,6 @@ use lemmy_db_schema::{
|
|||
};
|
||||
use lemmy_db_views::structs::LocalUserView;
|
||||
use lemmy_utils::{error::LemmyError, utils::remove_slurs, ConnectionId};
|
||||
use lemmy_websocket::{send::send_pm_ws_message, LemmyContext, UserOperationCrud};
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl PerformCrud for CreatePrivateMessage {
|
||||
|
|
|
@ -3,6 +3,8 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
private_message::{DeletePrivateMessage, PrivateMessageResponse},
|
||||
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_db_schema::{
|
||||
|
@ -10,7 +12,6 @@ use lemmy_db_schema::{
|
|||
traits::Crud,
|
||||
};
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::{send::send_pm_ws_message, LemmyContext, UserOperationCrud};
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl PerformCrud for DeletePrivateMessage {
|
||||
|
|
|
@ -3,11 +3,11 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
private_message::{GetPrivateMessages, PrivateMessagesResponse},
|
||||
utils::get_local_user_view_from_jwt,
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_db_schema::traits::DeleteableOrRemoveable;
|
||||
use lemmy_db_views::private_message_view::PrivateMessageQuery;
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl PerformCrud for GetPrivateMessages {
|
||||
|
|
|
@ -3,6 +3,8 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
private_message::{EditPrivateMessage, PrivateMessageResponse},
|
||||
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::{
|
||||
create_or_update::chat_message::CreateOrUpdateChatMessage,
|
||||
|
@ -17,7 +19,6 @@ use lemmy_db_schema::{
|
|||
utils::naive_now,
|
||||
};
|
||||
use lemmy_utils::{error::LemmyError, utils::remove_slurs, ConnectionId};
|
||||
use lemmy_websocket::{send::send_pm_ws_message, LemmyContext, UserOperationCrud};
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl PerformCrud for EditPrivateMessage {
|
||||
|
|
|
@ -10,6 +10,7 @@ use lemmy_api_common::{
|
|||
local_site_to_slur_regex,
|
||||
site_description_length_check,
|
||||
},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_apub::generate_site_inbox_url;
|
||||
use lemmy_db_schema::{
|
||||
|
@ -28,7 +29,6 @@ use lemmy_utils::{
|
|||
utils::{check_application_question, check_slurs, check_slurs_opt},
|
||||
ConnectionId,
|
||||
};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
use url::Url;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
|
|
|
@ -3,6 +3,8 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
site::{GetSite, GetSiteResponse, MyUserInfo},
|
||||
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_views::structs::{LocalUserDiscussionLanguageView, SiteView};
|
||||
|
@ -14,7 +16,6 @@ use lemmy_db_views_actor::structs::{
|
|||
PersonViewSafe,
|
||||
};
|
||||
use lemmy_utils::{error::LemmyError, version, ConnectionId};
|
||||
use lemmy_websocket::{messages::GetUsersOnline, LemmyContext};
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl PerformCrud for GetSite {
|
||||
|
|
|
@ -9,6 +9,8 @@ use lemmy_api_common::{
|
|||
local_site_to_slur_regex,
|
||||
site_description_length_check,
|
||||
},
|
||||
websocket::{messages::SendAllMessage, UserOperationCrud},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_db_schema::{
|
||||
source::{
|
||||
|
@ -31,7 +33,6 @@ use lemmy_utils::{
|
|||
utils::{check_application_question, check_slurs_opt},
|
||||
ConnectionId,
|
||||
};
|
||||
use lemmy_websocket::{messages::SendAllMessage, LemmyContext, UserOperationCrud};
|
||||
use std::str::FromStr;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
|
|
|
@ -10,6 +10,8 @@ use lemmy_api_common::{
|
|||
send_new_applicant_email_to_admins,
|
||||
send_verification_email,
|
||||
},
|
||||
websocket::messages::CheckCaptcha,
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_apub::{
|
||||
generate_inbox_url,
|
||||
|
@ -33,7 +35,6 @@ use lemmy_utils::{
|
|||
utils::{check_slurs, check_slurs_opt, is_valid_actor_name},
|
||||
ConnectionId,
|
||||
};
|
||||
use lemmy_websocket::{messages::CheckCaptcha, LemmyContext};
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl PerformCrud for Register {
|
||||
|
|
|
@ -4,10 +4,10 @@ use bcrypt::verify;
|
|||
use lemmy_api_common::{
|
||||
person::{DeleteAccount, DeleteAccountResponse},
|
||||
utils::{delete_user_account, get_local_user_view_from_jwt},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_apub::protocol::activities::deletion::delete_user::DeleteUser;
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl PerformCrud for DeleteAccount {
|
||||
|
|
|
@ -3,6 +3,7 @@ use actix_web::web::Data;
|
|||
use lemmy_api_common::{
|
||||
person::{GetPersonDetails, GetPersonDetailsResponse},
|
||||
utils::{check_private_instance, get_local_user_view_from_jwt_opt},
|
||||
LemmyContext,
|
||||
};
|
||||
use lemmy_apub::{fetcher::resolve_actor_identifier, objects::person::ApubPerson};
|
||||
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_actor::structs::{CommunityModeratorView, PersonViewSafe};
|
||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl PerformCrud for GetPersonDetails {
|
||||
|
|
|
@ -19,7 +19,6 @@ lemmy_db_schema = { workspace = true, features = ["full"] }
|
|||
lemmy_db_views = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_actor = { workspace = true, features = ["full"] }
|
||||
lemmy_api_common = { workspace = true, features = ["full"] }
|
||||
lemmy_websocket = { workspace = true }
|
||||
activitypub_federation = { workspace = true }
|
||||
diesel = { workspace = true }
|
||||
chrono = { workspace = true }
|
||||
|
|
|
@ -23,7 +23,10 @@ use activitypub_federation::{
|
|||
use activitystreams_kinds::{activity::BlockType, public};
|
||||
use anyhow::anyhow;
|
||||
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::{
|
||||
source::{
|
||||
community::{
|
||||
|
@ -38,7 +41,6 @@ use lemmy_db_schema::{
|
|||
traits::{Bannable, Crud, Followable},
|
||||
};
|
||||
use lemmy_utils::{error::LemmyError, utils::convert_datetime};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
use url::Url;
|
||||
|
||||
impl BlockUser {
|
||||
|
|
|
@ -5,9 +5,9 @@ use crate::{
|
|||
};
|
||||
use activitypub_federation::{core::object_id::ObjectId, traits::ApubObject};
|
||||
use chrono::NaiveDateTime;
|
||||
use lemmy_api_common::LemmyContext;
|
||||
use lemmy_db_schema::{source::site::Site, utils::DbPool};
|
||||
use lemmy_utils::error::LemmyError;
|
||||
use lemmy_websocket::LemmyContext;
|
||||
use serde::Deserialize;
|
||||
use url::Url;
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue