Redoing nightly fmt

This commit is contained in:
Dessalines 2020-09-12 12:40:39 -05:00
parent 0aef04f737
commit 6774bfd48d
44 changed files with 485 additions and 125 deletions

4
.rustfmt.toml vendored
View file

@ -1,5 +1,5 @@
tab_spaces = 2 tab_spaces = 2
edition="2018" edition="2018"
# imports_layout="HorizontalVertical" imports_layout="HorizontalVertical"
# merge_imports=true merge_imports=true
reorder_imports=true reorder_imports=true

View file

@ -1,6 +1,12 @@
use lemmy_db::{ use lemmy_db::{
category::*, comment_view::*, community_view::*, moderator_views::*, post_view::*, site_view::*, category::*,
user::*, user_view::*, comment_view::*,
community_view::*,
moderator_views::*,
post_view::*,
site_view::*,
user::*,
user_view::*,
}; };
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};

View file

@ -85,7 +85,9 @@ mod tests {
activity::{Activity, ActivityForm}, activity::{Activity, ActivityForm},
tests::establish_unpooled_connection, tests::establish_unpooled_connection,
user::{UserForm, User_}, user::{UserForm, User_},
Crud, ListingType, SortType, Crud,
ListingType,
SortType,
}; };
use serde_json::Value; use serde_json::Value;

View file

@ -2,7 +2,9 @@ use super::post::Post;
use crate::{ use crate::{
naive_now, naive_now,
schema::{comment, comment_like, comment_saved}, schema::{comment, comment_like, comment_saved},
Crud, Likeable, Saveable, Crud,
Likeable,
Saveable,
}; };
use diesel::{dsl::*, result::Error, *}; use diesel::{dsl::*, result::Error, *};
use url::{ParseError, Url}; use url::{ParseError, Url};
@ -255,8 +257,14 @@ impl Saveable<CommentSavedForm> for CommentSaved {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use crate::{ use crate::{
comment::*, community::*, post::*, tests::establish_unpooled_connection, user::*, Crud, comment::*,
ListingType, SortType, community::*,
post::*,
tests::establish_unpooled_connection,
user::*,
Crud,
ListingType,
SortType,
}; };
#[test] #[test]

View file

@ -495,8 +495,15 @@ impl<'a> ReplyQueryBuilder<'a> {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use crate::{ use crate::{
comment::*, comment_view::*, community::*, post::*, tests::establish_unpooled_connection, comment::*,
user::*, Crud, Likeable, *, comment_view::*,
community::*,
post::*,
tests::establish_unpooled_connection,
user::*,
Crud,
Likeable,
*,
}; };
#[test] #[test]

View file

@ -1,7 +1,10 @@
use crate::{ use crate::{
naive_now, naive_now,
schema::{community, community_follower, community_moderator, community_user_ban}, schema::{community, community_follower, community_moderator, community_user_ban},
Bannable, Crud, Followable, Joinable, Bannable,
Crud,
Followable,
Joinable,
}; };
use diesel::{dsl::*, result::Error, *}; use diesel::{dsl::*, result::Error, *};

View file

@ -1,7 +1,14 @@
use crate::{ use crate::{
schema::{ schema::{
mod_add, mod_add_community, mod_ban, mod_ban_from_community, mod_lock_post, mod_remove_comment, mod_add,
mod_remove_community, mod_remove_post, mod_sticky_post, mod_add_community,
mod_ban,
mod_ban_from_community,
mod_lock_post,
mod_remove_comment,
mod_remove_community,
mod_remove_post,
mod_sticky_post,
}, },
Crud, Crud,
}; };
@ -385,8 +392,14 @@ impl Crud<ModAddForm> for ModAdd {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use crate::{ use crate::{
comment::*, community::*, moderator::*, post::*, tests::establish_unpooled_connection, user::*, comment::*,
ListingType, SortType, community::*,
moderator::*,
post::*,
tests::establish_unpooled_connection,
user::*,
ListingType,
SortType,
}; };
// use Crud; // use Crud;

View file

@ -80,8 +80,11 @@ impl PasswordResetRequest {
mod tests { mod tests {
use super::super::user::*; use super::super::user::*;
use crate::{ use crate::{
password_reset_request::PasswordResetRequest, tests::establish_unpooled_connection, Crud, password_reset_request::PasswordResetRequest,
ListingType, SortType, tests::establish_unpooled_connection,
Crud,
ListingType,
SortType,
}; };
#[test] #[test]

View file

@ -1,7 +1,10 @@
use crate::{ use crate::{
naive_now, naive_now,
schema::{post, post_like, post_read, post_saved}, schema::{post, post_like, post_read, post_saved},
Crud, Likeable, Readable, Saveable, Crud,
Likeable,
Readable,
Saveable,
}; };
use diesel::{dsl::*, result::Error, *}; use diesel::{dsl::*, result::Error, *};
use url::{ParseError, Url}; use url::{ParseError, Url};
@ -325,7 +328,12 @@ impl Readable<PostReadForm> for PostRead {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use crate::{ use crate::{
community::*, post::*, tests::establish_unpooled_connection, user::*, ListingType, SortType, community::*,
post::*,
tests::establish_unpooled_connection,
user::*,
ListingType,
SortType,
}; };
#[test] #[test]

View file

@ -387,8 +387,14 @@ impl PostView {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use crate::{ use crate::{
community::*, post::*, post_view::*, tests::establish_unpooled_connection, user::*, Crud, community::*,
Likeable, *, post::*,
post_view::*,
tests::establish_unpooled_connection,
user::*,
Crud,
Likeable,
*,
}; };
#[test] #[test]

View file

@ -137,7 +137,11 @@ impl PrivateMessage {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use crate::{ use crate::{
private_message::*, tests::establish_unpooled_connection, user::*, ListingType, SortType, private_message::*,
tests::establish_unpooled_connection,
user::*,
ListingType,
SortType,
}; };
#[test] #[test]

View file

@ -1,5 +1,6 @@
use crate::{ use crate::{
is_email_regex, naive_now, is_email_regex,
naive_now,
schema::{user_, user_::dsl::*}, schema::{user_, user_::dsl::*},
Crud, Crud,
}; };

View file

@ -73,8 +73,14 @@ impl UserMention {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use crate::{ use crate::{
comment::*, community::*, post::*, tests::establish_unpooled_connection, user::*, comment::*,
user_mention::*, ListingType, SortType, community::*,
post::*,
tests::establish_unpooled_connection,
user::*,
user_mention::*,
ListingType,
SortType,
}; };
#[test] #[test]

View file

@ -24,7 +24,9 @@ use lettre::{
extension::ClientId, extension::ClientId,
ConnectionReuseParameters, ConnectionReuseParameters,
}, },
ClientSecurity, SmtpClient, Transport, ClientSecurity,
SmtpClient,
Transport,
}; };
use lettre_email::Email; use lettre_email::Email;
use openssl::{pkey::PKey, rsa::Rsa}; use openssl::{pkey::PKey, rsa::Rsa};
@ -221,8 +223,14 @@ pub fn is_valid_post_title(title: &str) -> bool {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use crate::{ use crate::{
is_valid_community_name, is_valid_post_title, is_valid_preferred_username, is_valid_username, is_valid_community_name,
remove_slurs, scrape_text_for_mentions, slur_check, slurs_vec_to_str, is_valid_post_title,
is_valid_preferred_username,
is_valid_username,
remove_slurs,
scrape_text_for_mentions,
slur_check,
slurs_vec_to_str,
}; };
#[test] #[test]

View file

@ -1,6 +1,10 @@
use crate::{ use crate::{
api::{ api::{
check_community_ban, get_post, get_user_from_jwt, get_user_from_jwt_opt, is_mod_or_admin, check_community_ban,
get_post,
get_user_from_jwt,
get_user_from_jwt_opt,
is_mod_or_admin,
Perform, Perform,
}, },
apub::{ApubLikeableType, ApubObjectType}, apub::{ApubLikeableType, ApubObjectType},
@ -9,17 +13,36 @@ use crate::{
messages::{JoinCommunityRoom, SendComment}, messages::{JoinCommunityRoom, SendComment},
UserOperation, UserOperation,
}, },
DbPool, LemmyContext, DbPool,
LemmyContext,
}; };
use actix_web::web::Data; use actix_web::web::Data;
use lemmy_api_structs::comment::*; use lemmy_api_structs::comment::*;
use lemmy_db::{ use lemmy_db::{
comment::*, comment_view::*, moderator::*, post::*, site_view::*, user::*, user_mention::*, Crud, comment::*,
Likeable, ListingType, Saveable, SortType, comment_view::*,
moderator::*,
post::*,
site_view::*,
user::*,
user_mention::*,
Crud,
Likeable,
ListingType,
Saveable,
SortType,
}; };
use lemmy_utils::{ use lemmy_utils::{
make_apub_endpoint, remove_slurs, scrape_text_for_mentions, send_email, settings::Settings, make_apub_endpoint,
APIError, ConnectionId, EndpointType, LemmyError, MentionData, remove_slurs,
scrape_text_for_mentions,
send_email,
settings::Settings,
APIError,
ConnectionId,
EndpointType,
LemmyError,
MentionData,
}; };
use log::error; use log::error;
use std::str::FromStr; use std::str::FromStr;

View file

@ -1,7 +1,12 @@
use crate::{ use crate::{
api::{ api::{
check_slurs, check_slurs_opt, get_user_from_jwt, get_user_from_jwt_opt, is_admin, check_slurs,
is_mod_or_admin, Perform, check_slurs_opt,
get_user_from_jwt,
get_user_from_jwt_opt,
is_admin,
is_mod_or_admin,
Perform,
}, },
apub::ActorType, apub::ActorType,
blocking, blocking,
@ -15,13 +20,32 @@ use actix_web::web::Data;
use anyhow::Context; use anyhow::Context;
use lemmy_api_structs::community::*; use lemmy_api_structs::community::*;
use lemmy_db::{ use lemmy_db::{
comment::Comment, comment_view::CommentQueryBuilder, community::*, community_view::*, comment::Comment,
diesel_option_overwrite, moderator::*, naive_now, post::Post, site::*, user_view::*, Bannable, comment_view::CommentQueryBuilder,
Crud, Followable, Joinable, SortType, community::*,
community_view::*,
diesel_option_overwrite,
moderator::*,
naive_now,
post::Post,
site::*,
user_view::*,
Bannable,
Crud,
Followable,
Joinable,
SortType,
}; };
use lemmy_utils::{ use lemmy_utils::{
generate_actor_keypair, is_valid_community_name, location_info, make_apub_endpoint, generate_actor_keypair,
naive_from_unix, APIError, ConnectionId, EndpointType, LemmyError, is_valid_community_name,
location_info,
make_apub_endpoint,
naive_from_unix,
APIError,
ConnectionId,
EndpointType,
LemmyError,
}; };
use std::str::FromStr; use std::str::FromStr;

View file

@ -1,7 +1,11 @@
use crate::{api::claims::Claims, blocking, DbPool, LemmyContext}; use crate::{api::claims::Claims, blocking, DbPool, LemmyContext};
use actix_web::web::Data; use actix_web::web::Data;
use lemmy_db::{ use lemmy_db::{
community::Community, community_view::CommunityUserBanView, post::Post, user::User_, Crud, community::Community,
community_view::CommunityUserBanView,
post::Post,
user::User_,
Crud,
}; };
use lemmy_utils::{slur_check, slurs_vec_to_str, APIError, ConnectionId, LemmyError}; use lemmy_utils::{slur_check, slurs_vec_to_str, APIError, ConnectionId, LemmyError};

View file

@ -1,10 +1,16 @@
use crate::{ use crate::{
api::{ api::{
check_community_ban, check_slurs, check_slurs_opt, get_user_from_jwt, get_user_from_jwt_opt, check_community_ban,
is_mod_or_admin, Perform, check_slurs,
check_slurs_opt,
get_user_from_jwt,
get_user_from_jwt_opt,
is_mod_or_admin,
Perform,
}, },
apub::{ApubLikeableType, ApubObjectType}, apub::{ApubLikeableType, ApubObjectType},
blocking, fetch_iframely_and_pictrs_data, blocking,
fetch_iframely_and_pictrs_data,
websocket::{ websocket::{
messages::{GetPostUsersOnline, JoinCommunityRoom, JoinPostRoom, SendPost}, messages::{GetPostUsersOnline, JoinCommunityRoom, JoinPostRoom, SendPost},
UserOperation, UserOperation,
@ -14,11 +20,26 @@ use crate::{
use actix_web::web::Data; use actix_web::web::Data;
use lemmy_api_structs::post::*; use lemmy_api_structs::post::*;
use lemmy_db::{ use lemmy_db::{
comment_view::*, community_view::*, moderator::*, naive_now, post::*, post_view::*, site_view::*, comment_view::*,
Crud, Likeable, ListingType, Saveable, SortType, community_view::*,
moderator::*,
naive_now,
post::*,
post_view::*,
site_view::*,
Crud,
Likeable,
ListingType,
Saveable,
SortType,
}; };
use lemmy_utils::{ use lemmy_utils::{
is_valid_post_title, make_apub_endpoint, APIError, ConnectionId, EndpointType, LemmyError, is_valid_post_title,
make_apub_endpoint,
APIError,
ConnectionId,
EndpointType,
LemmyError,
}; };
use std::str::FromStr; use std::str::FromStr;
use url::Url; use url::Url;

View file

@ -1,9 +1,15 @@
use crate::{ use crate::{
api::{ api::{
check_slurs, check_slurs_opt, get_user_from_jwt, get_user_from_jwt_opt, is_admin, Perform, check_slurs,
check_slurs_opt,
get_user_from_jwt,
get_user_from_jwt_opt,
is_admin,
Perform,
}, },
apub::fetcher::search_by_apub_id, apub::fetcher::search_by_apub_id,
blocking, version, blocking,
version,
websocket::{ websocket::{
messages::{GetUsersOnline, SendAllMessage}, messages::{GetUsersOnline, SendAllMessage},
UserOperation, UserOperation,
@ -14,9 +20,20 @@ use actix_web::web::Data;
use anyhow::Context; use anyhow::Context;
use lemmy_api_structs::{site::*, user::Register}; use lemmy_api_structs::{site::*, user::Register};
use lemmy_db::{ use lemmy_db::{
category::*, comment_view::*, community_view::*, diesel_option_overwrite, moderator::*, category::*,
moderator_views::*, naive_now, post_view::*, site::*, site_view::*, user_view::*, Crud, comment_view::*,
SearchType, SortType, community_view::*,
diesel_option_overwrite,
moderator::*,
moderator_views::*,
naive_now,
post_view::*,
site::*,
site_view::*,
user_view::*,
Crud,
SearchType,
SortType,
}; };
use lemmy_utils::{location_info, settings::Settings, APIError, ConnectionId, LemmyError}; use lemmy_utils::{location_info, settings::Settings, APIError, ConnectionId, LemmyError};
use log::{debug, info}; use log::{debug, info};

View file

@ -1,7 +1,8 @@
use crate::{ use crate::{
api::{check_slurs, claims::Claims, get_user_from_jwt, get_user_from_jwt_opt, is_admin, Perform}, api::{check_slurs, claims::Claims, get_user_from_jwt, get_user_from_jwt_opt, is_admin, Perform},
apub::ApubObjectType, apub::ApubObjectType,
blocking, captcha_espeak_wav_base64, blocking,
captcha_espeak_wav_base64,
websocket::{ websocket::{
messages::{CaptchaItem, CheckCaptcha, JoinUserRoom, SendAllMessage, SendUserRoomMessage}, messages::{CaptchaItem, CheckCaptcha, JoinUserRoom, SendAllMessage, SendUserRoomMessage},
UserOperation, UserOperation,
@ -15,15 +16,45 @@ use captcha::{gen, Difficulty};
use chrono::Duration; use chrono::Duration;
use lemmy_api_structs::user::*; use lemmy_api_structs::user::*;
use lemmy_db::{ use lemmy_db::{
comment::*, comment_view::*, community::*, community_view::*, diesel_option_overwrite, comment::*,
moderator::*, naive_now, password_reset_request::*, post::*, post_view::*, private_message::*, comment_view::*,
private_message_view::*, site::*, site_view::*, user::*, user_mention::*, user_mention_view::*, community::*,
user_view::*, Crud, Followable, Joinable, ListingType, SortType, community_view::*,
diesel_option_overwrite,
moderator::*,
naive_now,
password_reset_request::*,
post::*,
post_view::*,
private_message::*,
private_message_view::*,
site::*,
site_view::*,
user::*,
user_mention::*,
user_mention_view::*,
user_view::*,
Crud,
Followable,
Joinable,
ListingType,
SortType,
}; };
use lemmy_utils::{ use lemmy_utils::{
generate_actor_keypair, generate_random_string, is_valid_preferred_username, is_valid_username, generate_actor_keypair,
location_info, make_apub_endpoint, naive_from_unix, remove_slurs, send_email, settings::Settings, generate_random_string,
APIError, ConnectionId, EndpointType, LemmyError, is_valid_preferred_username,
is_valid_username,
location_info,
make_apub_endpoint,
naive_from_unix,
remove_slurs,
send_email,
settings::Settings,
APIError,
ConnectionId,
EndpointType,
LemmyError,
}; };
use log::error; use log::error;
use std::str::FromStr; use std::str::FromStr;

View file

@ -6,7 +6,13 @@ use activitystreams::{
use anyhow::{anyhow, Context, Error}; use anyhow::{anyhow, Context, Error};
use awc::Client; use awc::Client;
use background_jobs::{ use background_jobs::{
create_server, memory_storage::Storage, ActixJob, Backoff, MaxRetries, QueueHandle, WorkerConfig, create_server,
memory_storage::Storage,
ActixJob,
Backoff,
MaxRetries,
QueueHandle,
WorkerConfig,
}; };
use lemmy_utils::{location_info, settings::Settings, LemmyError}; use lemmy_utils::{location_info, settings::Settings, LemmyError};
use log::warn; use log::warn;

View file

@ -1,19 +1,36 @@
use crate::{ use crate::{
apub::{ apub::{
activities::{generate_activity_id, send_activity_to_community}, activities::{generate_activity_id, send_activity_to_community},
check_actor_domain, create_apub_response, create_apub_tombstone_response, create_tombstone, check_actor_domain,
create_apub_response,
create_apub_tombstone_response,
create_tombstone,
fetch_webfinger_url, fetch_webfinger_url,
fetcher::{ fetcher::{
get_or_fetch_and_insert_comment, get_or_fetch_and_insert_post, get_or_fetch_and_upsert_user, get_or_fetch_and_insert_comment,
get_or_fetch_and_insert_post,
get_or_fetch_and_upsert_user,
}, },
ActorType, ApubLikeableType, ApubObjectType, FromApub, ToApub, ActorType,
ApubLikeableType,
ApubObjectType,
FromApub,
ToApub,
}, },
blocking, DbPool, LemmyContext, blocking,
DbPool,
LemmyContext,
}; };
use activitystreams::{ use activitystreams::{
activity::{ activity::{
kind::{CreateType, DeleteType, DislikeType, LikeType, RemoveType, UndoType, UpdateType}, kind::{CreateType, DeleteType, DislikeType, LikeType, RemoveType, UndoType, UpdateType},
Create, Delete, Dislike, Like, Remove, Undo, Update, Create,
Delete,
Dislike,
Like,
Remove,
Undo,
Update,
}, },
base::AnyBase, base::AnyBase,
link::Mention, link::Mention,
@ -32,7 +49,12 @@ use lemmy_db::{
Crud, Crud,
}; };
use lemmy_utils::{ use lemmy_utils::{
convert_datetime, location_info, remove_slurs, scrape_text_for_mentions, LemmyError, MentionData, convert_datetime,
location_info,
remove_slurs,
scrape_text_for_mentions,
LemmyError,
MentionData,
}; };
use log::debug; use log::debug;
use serde::Deserialize; use serde::Deserialize;

View file

@ -3,17 +3,31 @@ use crate::{
apub::{ apub::{
activities::generate_activity_id, activities::generate_activity_id,
activity_queue::send_activity, activity_queue::send_activity,
check_actor_domain, create_apub_response, create_apub_tombstone_response, create_tombstone, check_actor_domain,
create_apub_response,
create_apub_tombstone_response,
create_tombstone,
extensions::group_extensions::GroupExtension, extensions::group_extensions::GroupExtension,
fetcher::{get_or_fetch_and_upsert_actor, get_or_fetch_and_upsert_user}, fetcher::{get_or_fetch_and_upsert_actor, get_or_fetch_and_upsert_user},
insert_activity, ActorType, FromApub, GroupExt, ToApub, insert_activity,
ActorType,
FromApub,
GroupExt,
ToApub,
}, },
blocking, DbPool, LemmyContext, blocking,
DbPool,
LemmyContext,
}; };
use activitystreams::{ use activitystreams::{
activity::{ activity::{
kind::{AcceptType, AnnounceType, DeleteType, LikeType, RemoveType, UndoType}, kind::{AcceptType, AnnounceType, DeleteType, LikeType, RemoveType, UndoType},
Accept, Announce, Delete, Follow, Remove, Undo, Accept,
Announce,
Delete,
Follow,
Remove,
Undo,
}, },
actor::{kind::GroupType, ApActor, Endpoints, Group}, actor::{kind::GroupType, ApActor, Endpoints, Group},
base::{AnyBase, BaseExt}, base::{AnyBase, BaseExt},

View file

@ -1,6 +1,11 @@
use crate::{ use crate::{
apub::{ apub::{
check_is_apub_id_valid, ActorType, FromApub, GroupExt, PageExt, PersonExt, check_is_apub_id_valid,
ActorType,
FromApub,
GroupExt,
PageExt,
PersonExt,
APUB_JSON_CONTENT_TYPE, APUB_JSON_CONTENT_TYPE,
}, },
blocking, blocking,
@ -22,7 +27,9 @@ use lemmy_db::{
post_view::PostView, post_view::PostView,
user::{UserForm, User_}, user::{UserForm, User_},
user_view::UserView, user_view::UserView,
Crud, Joinable, SearchType, Crud,
Joinable,
SearchType,
}; };
use lemmy_utils::{get_apub_protocol_string, location_info, LemmyError}; use lemmy_utils::{get_apub_protocol_string, location_info, LemmyError};
use log::debug; use log::debug;

View file

@ -1,8 +1,13 @@
use crate::{ use crate::{
apub::inbox::{ apub::inbox::{
activities::{ activities::{
create::receive_create, delete::receive_delete, dislike::receive_dislike, like::receive_like, create::receive_create,
remove::receive_remove, undo::receive_undo, update::receive_update, delete::receive_delete,
dislike::receive_dislike,
like::receive_like,
remove::receive_remove,
undo::receive_undo,
update::receive_update,
}, },
shared_inbox::{get_community_id_from_activity, receive_unhandled_activity}, shared_inbox::{get_community_id_from_activity, receive_unhandled_activity},
}, },

View file

@ -2,9 +2,13 @@ use crate::{
api::comment::send_local_notifs, api::comment::send_local_notifs,
apub::{ apub::{
inbox::shared_inbox::{ inbox::shared_inbox::{
announce_if_community_is_local, get_user_from_activity, receive_unhandled_activity, announce_if_community_is_local,
get_user_from_activity,
receive_unhandled_activity,
}, },
ActorType, FromApub, PageExt, ActorType,
FromApub,
PageExt,
}, },
blocking, blocking,
websocket::{ websocket::{

View file

@ -2,9 +2,14 @@ use crate::{
apub::{ apub::{
fetcher::{get_or_fetch_and_insert_comment, get_or_fetch_and_insert_post}, fetcher::{get_or_fetch_and_insert_comment, get_or_fetch_and_insert_post},
inbox::shared_inbox::{ inbox::shared_inbox::{
announce_if_community_is_local, get_user_from_activity, receive_unhandled_activity, announce_if_community_is_local,
get_user_from_activity,
receive_unhandled_activity,
}, },
ActorType, FromApub, GroupExt, PageExt, ActorType,
FromApub,
GroupExt,
PageExt,
}, },
blocking, blocking,
websocket::{ websocket::{
@ -17,7 +22,9 @@ use activitystreams::{activity::Delete, base::AnyBase, object::Note, prelude::*}
use actix_web::HttpResponse; use actix_web::HttpResponse;
use anyhow::Context; use anyhow::Context;
use lemmy_api_structs::{ use lemmy_api_structs::{
comment::CommentResponse, community::CommunityResponse, post::PostResponse, comment::CommentResponse,
community::CommunityResponse,
post::PostResponse,
}; };
use lemmy_db::{ use lemmy_db::{
comment::{Comment, CommentForm}, comment::{Comment, CommentForm},

View file

@ -2,9 +2,12 @@ use crate::{
apub::{ apub::{
fetcher::{get_or_fetch_and_insert_comment, get_or_fetch_and_insert_post}, fetcher::{get_or_fetch_and_insert_comment, get_or_fetch_and_insert_post},
inbox::shared_inbox::{ inbox::shared_inbox::{
announce_if_community_is_local, get_user_from_activity, receive_unhandled_activity, announce_if_community_is_local,
get_user_from_activity,
receive_unhandled_activity,
}, },
FromApub, PageExt, FromApub,
PageExt,
}, },
blocking, blocking,
websocket::{ websocket::{

View file

@ -2,9 +2,12 @@ use crate::{
apub::{ apub::{
fetcher::{get_or_fetch_and_insert_comment, get_or_fetch_and_insert_post}, fetcher::{get_or_fetch_and_insert_comment, get_or_fetch_and_insert_post},
inbox::shared_inbox::{ inbox::shared_inbox::{
announce_if_community_is_local, get_user_from_activity, receive_unhandled_activity, announce_if_community_is_local,
get_user_from_activity,
receive_unhandled_activity,
}, },
FromApub, PageExt, FromApub,
PageExt,
}, },
blocking, blocking,
websocket::{ websocket::{

View file

@ -2,10 +2,15 @@ use crate::{
apub::{ apub::{
fetcher::{get_or_fetch_and_insert_comment, get_or_fetch_and_insert_post}, fetcher::{get_or_fetch_and_insert_comment, get_or_fetch_and_insert_post},
inbox::shared_inbox::{ inbox::shared_inbox::{
announce_if_community_is_local, get_community_id_from_activity, get_user_from_activity, announce_if_community_is_local,
get_community_id_from_activity,
get_user_from_activity,
receive_unhandled_activity, receive_unhandled_activity,
}, },
ActorType, FromApub, GroupExt, PageExt, ActorType,
FromApub,
GroupExt,
PageExt,
}, },
blocking, blocking,
websocket::{ websocket::{
@ -18,7 +23,9 @@ use activitystreams::{activity::Remove, base::AnyBase, object::Note, prelude::*}
use actix_web::HttpResponse; use actix_web::HttpResponse;
use anyhow::{anyhow, Context}; use anyhow::{anyhow, Context};
use lemmy_api_structs::{ use lemmy_api_structs::{
comment::CommentResponse, community::CommunityResponse, post::PostResponse, comment::CommentResponse,
community::CommunityResponse,
post::PostResponse,
}; };
use lemmy_db::{ use lemmy_db::{
comment::{Comment, CommentForm}, comment::{Comment, CommentForm},

View file

@ -2,9 +2,14 @@ use crate::{
apub::{ apub::{
fetcher::{get_or_fetch_and_insert_comment, get_or_fetch_and_insert_post}, fetcher::{get_or_fetch_and_insert_comment, get_or_fetch_and_insert_post},
inbox::shared_inbox::{ inbox::shared_inbox::{
announce_if_community_is_local, get_user_from_activity, receive_unhandled_activity, announce_if_community_is_local,
get_user_from_activity,
receive_unhandled_activity,
}, },
ActorType, FromApub, GroupExt, PageExt, ActorType,
FromApub,
GroupExt,
PageExt,
}, },
blocking, blocking,
websocket::{ websocket::{
@ -22,7 +27,9 @@ use activitystreams::{
use actix_web::HttpResponse; use actix_web::HttpResponse;
use anyhow::{anyhow, Context}; use anyhow::{anyhow, Context};
use lemmy_api_structs::{ use lemmy_api_structs::{
comment::CommentResponse, community::CommunityResponse, post::PostResponse, comment::CommentResponse,
community::CommunityResponse,
post::PostResponse,
}; };
use lemmy_db::{ use lemmy_db::{
comment::{Comment, CommentForm, CommentLike}, comment::{Comment, CommentForm, CommentLike},
@ -32,7 +39,8 @@ use lemmy_db::{
naive_now, naive_now,
post::{Post, PostForm, PostLike}, post::{Post, PostForm, PostLike},
post_view::PostView, post_view::PostView,
Crud, Likeable, Crud,
Likeable,
}; };
use lemmy_utils::{location_info, LemmyError}; use lemmy_utils::{location_info, LemmyError};

View file

@ -3,9 +3,13 @@ use crate::{
apub::{ apub::{
fetcher::{get_or_fetch_and_insert_comment, get_or_fetch_and_insert_post}, fetcher::{get_or_fetch_and_insert_comment, get_or_fetch_and_insert_post},
inbox::shared_inbox::{ inbox::shared_inbox::{
announce_if_community_is_local, get_user_from_activity, receive_unhandled_activity, announce_if_community_is_local,
get_user_from_activity,
receive_unhandled_activity,
}, },
ActorType, FromApub, PageExt, ActorType,
FromApub,
PageExt,
}, },
blocking, blocking,
websocket::{ websocket::{

View file

@ -1,9 +1,13 @@
use crate::{ use crate::{
apub::{ apub::{
check_is_apub_id_valid, extensions::signatures::verify, fetcher::get_or_fetch_and_upsert_user, check_is_apub_id_valid,
insert_activity, ActorType, extensions::signatures::verify,
fetcher::get_or_fetch_and_upsert_user,
insert_activity,
ActorType,
}, },
blocking, LemmyContext, blocking,
LemmyContext,
}; };
use activitystreams::{ use activitystreams::{
activity::{ActorAndObject, Follow, Undo}, activity::{ActorAndObject, Follow, Undo},

View file

@ -4,12 +4,18 @@ use crate::{
community::do_announce, community::do_announce,
extensions::signatures::verify, extensions::signatures::verify,
fetcher::{ fetcher::{
get_or_fetch_and_upsert_actor, get_or_fetch_and_upsert_community, get_or_fetch_and_upsert_actor,
get_or_fetch_and_upsert_community,
get_or_fetch_and_upsert_user, get_or_fetch_and_upsert_user,
}, },
inbox::activities::{ inbox::activities::{
announce::receive_announce, create::receive_create, delete::receive_delete, announce::receive_announce,
dislike::receive_dislike, like::receive_like, remove::receive_remove, undo::receive_undo, create::receive_create,
delete::receive_delete,
dislike::receive_dislike,
like::receive_like,
remove::receive_remove,
undo::receive_undo,
update::receive_update, update::receive_update,
}, },
insert_activity, insert_activity,

View file

@ -3,7 +3,8 @@ use crate::{
check_is_apub_id_valid, check_is_apub_id_valid,
extensions::signatures::verify, extensions::signatures::verify,
fetcher::{get_or_fetch_and_upsert_actor, get_or_fetch_and_upsert_community}, fetcher::{get_or_fetch_and_upsert_actor, get_or_fetch_and_upsert_community},
insert_activity, FromApub, insert_activity,
FromApub,
}, },
blocking, blocking,
websocket::{messages::SendUserRoomMessage, UserOperation}, websocket::{messages::SendUserRoomMessage, UserOperation},
@ -24,7 +25,8 @@ use lemmy_db::{
private_message::{PrivateMessage, PrivateMessageForm}, private_message::{PrivateMessage, PrivateMessageForm},
private_message_view::PrivateMessageView, private_message_view::PrivateMessageView,
user::User_, user::User_,
Crud, Followable, Crud,
Followable,
}; };
use lemmy_utils::{location_info, LemmyError}; use lemmy_utils::{location_info, LemmyError};
use log::debug; use log::debug;

View file

@ -18,7 +18,8 @@ use crate::{
blocking, blocking,
request::{retry, RecvError}, request::{retry, RecvError},
routes::webfinger::WebFingerResponse, routes::webfinger::WebFingerResponse,
DbPool, LemmyContext, DbPool,
LemmyContext,
}; };
use activitystreams::{ use activitystreams::{
activity::Follow, activity::Follow,
@ -34,7 +35,11 @@ use anyhow::{anyhow, Context};
use chrono::NaiveDateTime; use chrono::NaiveDateTime;
use lemmy_db::{activity::do_insert_activity, user::User_}; use lemmy_db::{activity::do_insert_activity, user::User_};
use lemmy_utils::{ use lemmy_utils::{
convert_datetime, get_apub_protocol_string, location_info, settings::Settings, LemmyError, convert_datetime,
get_apub_protocol_string,
location_info,
settings::Settings,
LemmyError,
MentionData, MentionData,
}; };
use log::debug; use log::debug;

View file

@ -2,17 +2,33 @@ use crate::{
api::check_slurs, api::check_slurs,
apub::{ apub::{
activities::{generate_activity_id, send_activity_to_community}, activities::{generate_activity_id, send_activity_to_community},
check_actor_domain, create_apub_response, create_apub_tombstone_response, create_tombstone, check_actor_domain,
create_apub_response,
create_apub_tombstone_response,
create_tombstone,
extensions::page_extension::PageExtension, extensions::page_extension::PageExtension,
fetcher::{get_or_fetch_and_upsert_community, get_or_fetch_and_upsert_user}, fetcher::{get_or_fetch_and_upsert_community, get_or_fetch_and_upsert_user},
ActorType, ApubLikeableType, ApubObjectType, FromApub, PageExt, ToApub, ActorType,
ApubLikeableType,
ApubObjectType,
FromApub,
PageExt,
ToApub,
}, },
blocking, DbPool, LemmyContext, blocking,
DbPool,
LemmyContext,
}; };
use activitystreams::{ use activitystreams::{
activity::{ activity::{
kind::{CreateType, DeleteType, DislikeType, LikeType, RemoveType, UndoType, UpdateType}, kind::{CreateType, DeleteType, DislikeType, LikeType, RemoveType, UndoType, UpdateType},
Create, Delete, Dislike, Like, Remove, Undo, Update, Create,
Delete,
Dislike,
Like,
Remove,
Undo,
Update,
}, },
object::{kind::PageType, Image, Object, Page, Tombstone}, object::{kind::PageType, Image, Object, Page, Tombstone},
prelude::*, prelude::*,

View file

@ -1,15 +1,28 @@
use crate::{ use crate::{
apub::{ apub::{
activities::generate_activity_id, activity_queue::send_activity, check_actor_domain, activities::generate_activity_id,
check_is_apub_id_valid, create_tombstone, fetcher::get_or_fetch_and_upsert_user, activity_queue::send_activity,
insert_activity, ActorType, ApubObjectType, FromApub, ToApub, check_actor_domain,
check_is_apub_id_valid,
create_tombstone,
fetcher::get_or_fetch_and_upsert_user,
insert_activity,
ActorType,
ApubObjectType,
FromApub,
ToApub,
}, },
blocking, DbPool, LemmyContext, blocking,
DbPool,
LemmyContext,
}; };
use activitystreams::{ use activitystreams::{
activity::{ activity::{
kind::{CreateType, DeleteType, UndoType, UpdateType}, kind::{CreateType, DeleteType, UndoType, UpdateType},
Create, Delete, Undo, Update, Create,
Delete,
Undo,
Update,
}, },
object::{kind::NoteType, Note, Tombstone}, object::{kind::NoteType, Note, Tombstone},
prelude::*, prelude::*,

View file

@ -1,16 +1,26 @@
use crate::{ use crate::{
api::{check_slurs, check_slurs_opt}, api::{check_slurs, check_slurs_opt},
apub::{ apub::{
activities::generate_activity_id, activity_queue::send_activity, check_actor_domain, activities::generate_activity_id,
create_apub_response, fetcher::get_or_fetch_and_upsert_actor, insert_activity, ActorType, activity_queue::send_activity,
FromApub, PersonExt, ToApub, check_actor_domain,
create_apub_response,
fetcher::get_or_fetch_and_upsert_actor,
insert_activity,
ActorType,
FromApub,
PersonExt,
ToApub,
}, },
blocking, DbPool, LemmyContext, blocking,
DbPool,
LemmyContext,
}; };
use activitystreams::{ use activitystreams::{
activity::{ activity::{
kind::{FollowType, UndoType}, kind::{FollowType, UndoType},
Follow, Undo, Follow,
Undo,
}, },
actor::{ApActor, Endpoints, Person}, actor::{ApActor, Endpoints, Person},
object::{Image, Tombstone}, object::{Image, Tombstone},

View file

@ -13,8 +13,12 @@ use lemmy_db::{
Crud, Crud,
}; };
use lemmy_utils::{ use lemmy_utils::{
generate_actor_keypair, get_apub_protocol_string, make_apub_endpoint, settings::Settings, generate_actor_keypair,
EndpointType, LemmyError, get_apub_protocol_string,
make_apub_endpoint,
settings::Settings,
EndpointType,
LemmyError,
}; };
use log::info; use log::info;

View file

@ -19,8 +19,12 @@ use lazy_static::lazy_static;
use lemmy_db::get_database_url_from_env; use lemmy_db::get_database_url_from_env;
use lemmy_rate_limit::{rate_limiter::RateLimiter, RateLimit}; use lemmy_rate_limit::{rate_limiter::RateLimiter, RateLimit};
use lemmy_server::{ use lemmy_server::{
apub::activity_queue::create_activity_queue, blocking, code_migrations::run_advanced_migrations, apub::activity_queue::create_activity_queue,
routes::*, websocket::chat_server::ChatServer, LemmyContext, blocking,
code_migrations::run_advanced_migrations,
routes::*,
websocket::chat_server::ChatServer,
LemmyContext,
}; };
use lemmy_utils::{settings::Settings, LemmyError, CACHE_CONTROL_REGEX}; use lemmy_utils::{settings::Settings, LemmyError, CACHE_CONTROL_REGEX};
use reqwest::Client; use reqwest::Client;

View file

@ -10,7 +10,8 @@ use lemmy_db::{
site_view::SiteView, site_view::SiteView,
user::User_, user::User_,
user_mention_view::{UserMentionQueryBuilder, UserMentionView}, user_mention_view::{UserMentionQueryBuilder, UserMentionView},
ListingType, SortType, ListingType,
SortType,
}; };
use lemmy_utils::{markdown_to_html, settings::Settings, LemmyError}; use lemmy_utils::{markdown_to_html, settings::Settings, LemmyError};
use rss::{CategoryBuilder, ChannelBuilder, GuidBuilder, Item, ItemBuilder}; use rss::{CategoryBuilder, ChannelBuilder, GuidBuilder, Item, ItemBuilder};

View file

@ -3,7 +3,10 @@ use actix_web::{error::ErrorBadRequest, web::Query, *};
use anyhow::anyhow; use anyhow::anyhow;
use lemmy_db::{community::Community, user::User_}; use lemmy_db::{community::Community, user::User_};
use lemmy_utils::{ use lemmy_utils::{
settings::Settings, LemmyError, WEBFINGER_COMMUNITY_REGEX, WEBFINGER_USER_REGEX, settings::Settings,
LemmyError,
WEBFINGER_COMMUNITY_REGEX,
WEBFINGER_USER_REGEX,
}; };
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};

View file

@ -16,7 +16,14 @@ use diesel::{
use lemmy_api_structs::{comment::*, community::*, post::*, site::*, user::*}; use lemmy_api_structs::{comment::*, community::*, post::*, site::*, user::*};
use lemmy_rate_limit::RateLimit; use lemmy_rate_limit::RateLimit;
use lemmy_utils::{ use lemmy_utils::{
location_info, APIError, CommunityId, ConnectionId, IPAddr, LemmyError, PostId, UserId, location_info,
APIError,
CommunityId,
ConnectionId,
IPAddr,
LemmyError,
PostId,
UserId,
}; };
use rand::rngs::ThreadRng; use rand::rngs::ThreadRng;
use reqwest::Client; use reqwest::Client;