Merge branch 'main' into bearer-token

This commit is contained in:
SleeplessOne1917 2023-09-24 17:41:49 -04:00
commit ed8dae99f1
156 changed files with 1161 additions and 375 deletions

24
Cargo.lock generated
View file

@ -2621,7 +2621,7 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "lemmy_api"
version = "0.18.1"
version = "0.18.4"
dependencies = [
"activitypub_federation",
"actix-web",
@ -2651,7 +2651,7 @@ dependencies = [
[[package]]
name = "lemmy_api_common"
version = "0.18.1"
version = "0.18.4"
dependencies = [
"activitypub_federation",
"actix-web",
@ -2683,7 +2683,7 @@ dependencies = [
[[package]]
name = "lemmy_api_crud"
version = "0.18.1"
version = "0.18.4"
dependencies = [
"activitypub_federation",
"actix-web",
@ -2705,7 +2705,7 @@ dependencies = [
[[package]]
name = "lemmy_apub"
version = "0.18.1"
version = "0.18.4"
dependencies = [
"activitypub_federation",
"actix-web",
@ -2742,7 +2742,7 @@ dependencies = [
[[package]]
name = "lemmy_db_schema"
version = "0.18.1"
version = "0.18.4"
dependencies = [
"activitypub_federation",
"async-trait",
@ -2778,7 +2778,7 @@ dependencies = [
[[package]]
name = "lemmy_db_views"
version = "0.18.1"
version = "0.18.4"
dependencies = [
"actix-web",
"diesel",
@ -2796,7 +2796,7 @@ dependencies = [
[[package]]
name = "lemmy_db_views_actor"
version = "0.18.1"
version = "0.18.4"
dependencies = [
"chrono",
"diesel",
@ -2809,7 +2809,7 @@ dependencies = [
[[package]]
name = "lemmy_db_views_moderator"
version = "0.18.1"
version = "0.18.4"
dependencies = [
"diesel",
"diesel-async",
@ -2821,7 +2821,7 @@ dependencies = [
[[package]]
name = "lemmy_federate"
version = "0.18.1"
version = "0.18.4"
dependencies = [
"activitypub_federation",
"anyhow",
@ -2853,7 +2853,7 @@ dependencies = [
[[package]]
name = "lemmy_routes"
version = "0.18.1"
version = "0.18.4"
dependencies = [
"activitypub_federation",
"actix-web",
@ -2878,7 +2878,7 @@ dependencies = [
[[package]]
name = "lemmy_server"
version = "0.18.1"
version = "0.18.4"
dependencies = [
"activitypub_federation",
"actix-cors",
@ -2926,7 +2926,7 @@ dependencies = [
[[package]]
name = "lemmy_utils"
version = "0.18.1"
version = "0.18.4"
dependencies = [
"actix-web",
"anyhow",

View file

@ -1,5 +1,5 @@
[workspace.package]
version = "0.18.1"
version = "0.18.4"
edition = "2021"
description = "A link aggregator for the fediverse"
license = "AGPL-3.0"
@ -58,16 +58,16 @@ members = [
]
[workspace.dependencies]
lemmy_api = { version = "=0.18.1", path = "./crates/api" }
lemmy_api_crud = { version = "=0.18.1", path = "./crates/api_crud" }
lemmy_apub = { version = "=0.18.1", path = "./crates/apub" }
lemmy_utils = { version = "=0.18.1", path = "./crates/utils" }
lemmy_db_schema = { version = "=0.18.1", path = "./crates/db_schema" }
lemmy_api_common = { version = "=0.18.1", path = "./crates/api_common" }
lemmy_routes = { version = "=0.18.1", path = "./crates/routes" }
lemmy_db_views = { version = "=0.18.1", path = "./crates/db_views" }
lemmy_db_views_actor = { version = "=0.18.1", path = "./crates/db_views_actor" }
lemmy_db_views_moderator = { version = "=0.18.1", path = "./crates/db_views_moderator" }
lemmy_api = { version = "=0.18.4", path = "./crates/api" }
lemmy_api_crud = { version = "=0.18.4", path = "./crates/api_crud" }
lemmy_apub = { version = "=0.18.4", path = "./crates/apub" }
lemmy_utils = { version = "=0.18.4", path = "./crates/utils" }
lemmy_db_schema = { version = "=0.18.4", path = "./crates/db_schema" }
lemmy_api_common = { version = "=0.18.4", path = "./crates/api_common" }
lemmy_routes = { version = "=0.18.4", path = "./crates/routes" }
lemmy_db_views = { version = "=0.18.4", path = "./crates/db_views" }
lemmy_db_views_actor = { version = "=0.18.4", path = "./crates/db_views_actor" }
lemmy_db_views_moderator = { version = "=0.18.4", path = "./crates/db_views_moderator" }
activitypub_federation = { version = "0.5.0-beta.3", default-features = false, features = [
"actix-web",
] }
@ -169,5 +169,5 @@ prometheus = { version = "0.13.3", features = ["process"], optional = true }
actix-web-prom = { version = "0.6.0", optional = true }
serial_test = { workspace = true }
clap = { version = "4.3.19", features = ["derive"] }
lemmy_federate = { version = "0.18.1", path = "crates/federate" }
actix-web-httpauth = { workspace = true }
lemmy_federate = { version = "0.18.4", path = "crates/federate" }

View file

@ -9,7 +9,10 @@ use lemmy_api_common::{
use lemmy_db_schema::{
source::{
community::{
CommunityFollower, CommunityFollowerForm, CommunityPersonBan, CommunityPersonBanForm,
CommunityFollower,
CommunityFollowerForm,
CommunityPersonBan,
CommunityPersonBanForm,
},
moderator::{ModBanFromCommunity, ModBanFromCommunityForm},
},

View file

@ -5,7 +5,8 @@ use lemmy_api_common::{
utils::password_length_check,
};
use lemmy_db_schema::source::{
local_user::LocalUser, password_reset_request::PasswordResetRequest,
local_user::LocalUser,
password_reset_request::PasswordResetRequest,
};
use lemmy_utils::error::{LemmyError, LemmyErrorExt, LemmyErrorType};

View file

@ -2,7 +2,9 @@ use crate::{build_totp_2fa, generate_totp_2fa_secret};
use activitypub_federation::config::Data;
use actix_web::web::Json;
use lemmy_api_common::{
context::LemmyContext, person::GenerateTotpSecretResponse, sensitive::Sensitive,
context::LemmyContext,
person::GenerateTotpSecretResponse,
sensitive::Sensitive,
};
use lemmy_db_schema::{
source::local_user::{LocalUser, LocalUserUpdateForm},

View file

@ -1,7 +1,9 @@
use actix_web::web::{Data, Json};
use lemmy_api_common::{context::LemmyContext, person::GetRepliesResponse};
use lemmy_db_schema::source::{
comment_reply::CommentReply, person_mention::PersonMention, private_message::PrivateMessage,
comment_reply::CommentReply,
person_mention::PersonMention,
private_message::PrivateMessage,
};
use lemmy_db_views::structs::LocalUserView;
use lemmy_utils::error::{LemmyError, LemmyErrorExt, LemmyErrorType};

View file

@ -4,7 +4,10 @@ use lemmy_api_common::{
person::{GetReportCount, GetReportCountResponse},
};
use lemmy_db_views::structs::{
CommentReportView, LocalUserView, PostReportView, PrivateMessageReportView,
CommentReportView,
LocalUserView,
PostReportView,
PrivateMessageReportView,
};
use lemmy_utils::error::LemmyError;

View file

@ -6,7 +6,9 @@ use lemmy_api_common::{
post::{CreatePostLike, PostResponse},
send_activity::{ActivityChannel, SendActivityData},
utils::{
check_community_ban, check_community_deleted_or_removed, check_downvotes_enabled,
check_community_ban,
check_community_deleted_or_removed,
check_downvotes_enabled,
mark_post_as_read,
},
};

View file

@ -5,7 +5,8 @@ use lemmy_api_common::{
utils::is_admin,
};
use lemmy_db_views::{
private_message_report_view::PrivateMessageReportQuery, structs::LocalUserView,
private_message_report_view::PrivateMessageReportQuery,
structs::LocalUserView,
};
use lemmy_utils::error::LemmyError;

View file

@ -1,6 +1,8 @@
use actix_web::web::{Data, Json};
use lemmy_api_common::{
context::LemmyContext, site::GetFederatedInstancesResponse, utils::build_federated_instances,
context::LemmyContext,
site::GetFederatedInstancesResponse,
utils::build_federated_instances,
};
use lemmy_db_views::structs::SiteView;
use lemmy_utils::error::LemmyError;

View file

@ -11,10 +11,22 @@ use lemmy_db_schema::{
};
use lemmy_db_views::structs::LocalUserView;
use lemmy_db_views_moderator::structs::{
AdminPurgeCommentView, AdminPurgeCommunityView, AdminPurgePersonView, AdminPurgePostView,
ModAddCommunityView, ModAddView, ModBanFromCommunityView, ModBanView, ModFeaturePostView,
ModHideCommunityView, ModLockPostView, ModRemoveCommentView, ModRemoveCommunityView,
ModRemovePostView, ModTransferCommunityView, ModlogListParams,
AdminPurgeCommentView,
AdminPurgeCommunityView,
AdminPurgePersonView,
AdminPurgePostView,
ModAddCommunityView,
ModAddView,
ModBanFromCommunityView,
ModBanView,
ModFeaturePostView,
ModHideCommunityView,
ModLockPostView,
ModRemoveCommentView,
ModRemoveCommunityView,
ModRemovePostView,
ModTransferCommunityView,
ModlogListParams,
};
use lemmy_utils::error::LemmyError;
use ModlogActionType::*;

View file

@ -6,7 +6,8 @@ use lemmy_api_common::{
};
use lemmy_db_schema::source::local_site::LocalSite;
use lemmy_db_views::{
registration_application_view::RegistrationApplicationQuery, structs::LocalUserView,
registration_application_view::RegistrationApplicationQuery,
structs::LocalUserView,
};
use lemmy_utils::error::LemmyError;

View file

@ -1,6 +1,8 @@
use actix_web::web::{Data, Json};
use lemmy_api_common::{
context::LemmyContext, site::GetUnreadRegistrationApplicationCountResponse, utils::is_admin,
context::LemmyContext,
site::GetUnreadRegistrationApplicationCountResponse,
utils::is_admin,
};
use lemmy_db_schema::source::local_site::LocalSite;
use lemmy_db_views::structs::{LocalUserView, RegistrationApplicationView};

View file

@ -1,6 +1,7 @@
use lemmy_db_schema::{
newtypes::{CommentId, CommentReportId, CommunityId, LanguageId, LocalUserId, PostId},
CommentSortType, ListingType,
CommentSortType,
ListingType,
};
use lemmy_db_views::structs::{CommentReportView, CommentView};
use serde::{Deserialize, Serialize};

View file

@ -1,7 +1,8 @@
use lemmy_db_schema::{
newtypes::{CommunityId, LanguageId, PersonId},
source::site::Site,
ListingType, SortType,
ListingType,
SortType,
};
use lemmy_db_views_actor::structs::{CommunityModeratorView, CommunityView, PersonView};
use serde::{Deserialize, Serialize};

View file

@ -1,11 +1,16 @@
use crate::sensitive::Sensitive;
use lemmy_db_schema::{
newtypes::{CommentReplyId, CommunityId, LanguageId, PersonId, PersonMentionId},
CommentSortType, ListingType, SortType,
CommentSortType,
ListingType,
SortType,
};
use lemmy_db_views::structs::{CommentView, PostView};
use lemmy_db_views_actor::structs::{
CommentReplyView, CommunityModeratorView, PersonMentionView, PersonView,
CommentReplyView,
CommunityModeratorView,
PersonMentionView,
PersonView,
};
use serde::{Deserialize, Serialize};
use serde_with::skip_serializing_none;

View file

@ -1,6 +1,8 @@
use lemmy_db_schema::{
newtypes::{CommentId, CommunityId, DbUrl, LanguageId, PostId, PostReportId},
ListingType, PostFeatureType, SortType,
ListingType,
PostFeatureType,
SortType,
};
use lemmy_db_views::structs::{PaginationCursor, PostReportView, PostView};
use lemmy_db_views_actor::structs::{CommunityModeratorView, CommunityView};

View file

@ -302,7 +302,10 @@ mod tests {
#![allow(clippy::indexing_slicing)]
use crate::request::{
build_user_agent, fetch_site_metadata, html_to_site_metadata, SiteMetadata,
build_user_agent,
fetch_site_metadata,
html_to_site_metadata,
SiteMetadata,
};
use lemmy_utils::settings::SETTINGS;
use url::Url;

View file

@ -9,7 +9,10 @@ use futures::future::BoxFuture;
use lemmy_db_schema::{
newtypes::{CommunityId, DbUrl, PersonId},
source::{
comment::Comment, community::Community, person::Person, post::Post,
comment::Comment,
community::Community,
person::Person,
post::Post,
private_message::PrivateMessage,
},
};

View file

@ -1,20 +1,45 @@
use lemmy_db_schema::{
newtypes::{CommentId, CommunityId, InstanceId, LanguageId, PersonId, PostId},
source::{instance::Instance, language::Language, tagline::Tagline},
ListingType, ModlogActionType, RegistrationMode, SearchType, SortType,
ListingType,
ModlogActionType,
RegistrationMode,
SearchType,
SortType,
};
use lemmy_db_views::structs::{
CommentView, CustomEmojiView, LocalUserView, PostView, RegistrationApplicationView, SiteView,
CommentView,
CustomEmojiView,
LocalUserView,
PostView,
RegistrationApplicationView,
SiteView,
};
use lemmy_db_views_actor::structs::{
CommunityBlockView, CommunityFollowerView, CommunityModeratorView, CommunityView,
InstanceBlockView, PersonBlockView, PersonView,
CommunityBlockView,
CommunityFollowerView,
CommunityModeratorView,
CommunityView,
InstanceBlockView,
PersonBlockView,
PersonView,
};
use lemmy_db_views_moderator::structs::{
AdminPurgeCommentView, AdminPurgeCommunityView, AdminPurgePersonView, AdminPurgePostView,
ModAddCommunityView, ModAddView, ModBanFromCommunityView, ModBanView, ModFeaturePostView,
ModHideCommunityView, ModLockPostView, ModRemoveCommentView, ModRemoveCommunityView,
ModRemovePostView, ModTransferCommunityView,
AdminPurgeCommentView,
AdminPurgeCommunityView,
AdminPurgePersonView,
AdminPurgePostView,
ModAddCommunityView,
ModAddView,
ModBanFromCommunityView,
ModBanView,
ModFeaturePostView,
ModHideCommunityView,
ModLockPostView,
ModRemoveCommentView,
ModRemoveCommunityView,
ModRemovePostView,
ModTransferCommunityView,
};
use serde::{Deserialize, Serialize};
use serde_with::skip_serializing_none;

View file

@ -21,7 +21,9 @@ use lemmy_db_schema::{
};
use lemmy_db_views::{comment_view::CommentQuery, structs::LocalUserView};
use lemmy_db_views_actor::structs::{
CommunityModeratorView, CommunityPersonBanView, CommunityView,
CommunityModeratorView,
CommunityPersonBanView,
CommunityView,
};
use lemmy_utils::{
email::{send_email, translations::Lang},

View file

@ -6,8 +6,13 @@ use lemmy_api_common::{
context::LemmyContext,
send_activity::{ActivityChannel, SendActivityData},
utils::{
check_community_ban, check_community_deleted_or_removed, check_post_deleted_or_removed,
generate_local_apub_endpoint, get_post, local_site_to_slur_regex, sanitize_html_api,
check_community_ban,
check_community_deleted_or_removed,
check_post_deleted_or_removed,
generate_local_apub_endpoint,
get_post,
local_site_to_slur_regex,
sanitize_html_api,
EndpointType,
},
};
@ -26,7 +31,9 @@ use lemmy_db_views::structs::LocalUserView;
use lemmy_utils::{
error::{LemmyError, LemmyErrorExt, LemmyErrorType},
utils::{
mention::scrape_text_for_mentions, slurs::remove_slurs, validation::is_valid_body_field,
mention::scrape_text_for_mentions,
slurs::remove_slurs,
validation::is_valid_body_field,
},
};

View file

@ -20,7 +20,9 @@ use lemmy_db_views::structs::{CommentView, LocalUserView};
use lemmy_utils::{
error::{LemmyError, LemmyErrorExt, LemmyErrorType},
utils::{
mention::scrape_text_for_mentions, slurs::remove_slurs, validation::is_valid_body_field,
mention::scrape_text_for_mentions,
slurs::remove_slurs,
validation::is_valid_body_field,
},
};

View file

@ -5,16 +5,26 @@ use lemmy_api_common::{
community::{CommunityResponse, CreateCommunity},
context::LemmyContext,
utils::{
generate_followers_url, generate_inbox_url, generate_local_apub_endpoint,
generate_shared_inbox_url, is_admin, local_site_to_slur_regex, sanitize_html_api,
sanitize_html_api_opt, EndpointType,
generate_followers_url,
generate_inbox_url,
generate_local_apub_endpoint,
generate_shared_inbox_url,
is_admin,
local_site_to_slur_regex,
sanitize_html_api,
sanitize_html_api_opt,
EndpointType,
},
};
use lemmy_db_schema::{
source::{
actor_language::{CommunityLanguage, SiteLanguage},
community::{
Community, CommunityFollower, CommunityFollowerForm, CommunityInsertForm, CommunityModerator,
Community,
CommunityFollower,
CommunityFollowerForm,
CommunityInsertForm,
CommunityModerator,
CommunityModeratorForm,
},
},

View file

@ -7,9 +7,15 @@ use lemmy_api_common::{
request::fetch_site_data,
send_activity::{ActivityChannel, SendActivityData},
utils::{
check_community_ban, check_community_deleted_or_removed, generate_local_apub_endpoint,
honeypot_check, local_site_to_slur_regex, mark_post_as_read, sanitize_html_api,
sanitize_html_api_opt, EndpointType,
check_community_ban,
check_community_deleted_or_removed,
generate_local_apub_endpoint,
honeypot_check,
local_site_to_slur_regex,
mark_post_as_read,
sanitize_html_api,
sanitize_html_api_opt,
EndpointType,
},
};
use lemmy_db_schema::{

View file

@ -5,8 +5,13 @@ use lemmy_api_common::{
private_message::{CreatePrivateMessage, PrivateMessageResponse},
send_activity::{ActivityChannel, SendActivityData},
utils::{
check_person_block, generate_local_apub_endpoint, get_interface_language,
local_site_to_slur_regex, sanitize_html_api, send_email_to_user, EndpointType,
check_person_block,
generate_local_apub_endpoint,
get_interface_language,
local_site_to_slur_regex,
sanitize_html_api,
send_email_to_user,
EndpointType,
},
};
use lemmy_db_schema::{

View file

@ -5,8 +5,11 @@ use lemmy_api_common::{
context::LemmyContext,
site::{CreateSite, SiteResponse},
utils::{
generate_site_inbox_url, is_admin, local_site_rate_limit_to_rate_limit_config,
sanitize_html_api, sanitize_html_api_opt,
generate_site_inbox_url,
is_admin,
local_site_rate_limit_to_rate_limit_config,
sanitize_html_api,
sanitize_html_api_opt,
},
};
use lemmy_db_schema::{
@ -26,8 +29,11 @@ use lemmy_utils::{
utils::{
slurs::{check_slurs, check_slurs_opt},
validation::{
build_and_check_regex, check_site_visibility_valid, is_valid_body_field,
site_description_length_check, site_name_length_check,
build_and_check_regex,
check_site_visibility_valid,
is_valid_body_field,
site_description_length_check,
site_name_length_check,
},
},
};

View file

@ -10,8 +10,12 @@ use lemmy_db_schema::source::{
};
use lemmy_db_views::structs::{CustomEmojiView, LocalUserView, SiteView};
use lemmy_db_views_actor::structs::{
CommunityBlockView, CommunityFollowerView, CommunityModeratorView, InstanceBlockView,
PersonBlockView, PersonView,
CommunityBlockView,
CommunityFollowerView,
CommunityModeratorView,
InstanceBlockView,
PersonBlockView,
PersonView,
};
use lemmy_utils::{
error::{LemmyError, LemmyErrorExt, LemmyErrorType},

View file

@ -26,8 +26,11 @@ use lemmy_utils::{
utils::{
slurs::check_slurs_opt,
validation::{
build_and_check_regex, check_site_visibility_valid, is_valid_body_field,
site_description_length_check, site_name_length_check,
build_and_check_regex,
check_site_visibility_valid,
is_valid_body_field,
site_description_length_check,
site_name_length_check,
},
},
};

View file

@ -4,9 +4,17 @@ use lemmy_api_common::{
context::LemmyContext,
person::{LoginResponse, Register},
utils::{
generate_inbox_url, generate_local_apub_endpoint, generate_shared_inbox_url, honeypot_check,
local_site_to_slur_regex, password_length_check, sanitize_html_api, sanitize_html_api_opt,
send_new_applicant_email_to_admins, send_verification_email, EndpointType,
generate_inbox_url,
generate_local_apub_endpoint,
generate_shared_inbox_url,
honeypot_check,
local_site_to_slur_regex,
password_length_check,
sanitize_html_api,
sanitize_html_api_opt,
send_new_applicant_email_to_admins,
send_verification_email,
EndpointType,
},
};
use lemmy_db_schema::{

View file

@ -2,7 +2,10 @@ use crate::{
activities::{
block::{generate_cc, SiteOrCommunity},
community::send_activity_in_community,
generate_activity_id, send_lemmy_activity, verify_is_public, verify_mod_action,
generate_activity_id,
send_lemmy_activity,
verify_is_public,
verify_mod_action,
verify_person_in_community,
},
activity_lists::AnnouncableActivities,
@ -26,7 +29,10 @@ use lemmy_db_schema::{
source::{
activity::ActivitySendTargets,
community::{
CommunityFollower, CommunityFollowerForm, CommunityPersonBan, CommunityPersonBanForm,
CommunityFollower,
CommunityFollowerForm,
CommunityPersonBan,
CommunityPersonBanForm,
},
moderator::{ModBan, ModBanForm, ModBanFromCommunity, ModBanFromCommunityForm},
person::{Person, PersonUpdateForm},

View file

@ -2,7 +2,9 @@ use crate::{
activities::{
block::{generate_cc, SiteOrCommunity},
community::send_activity_in_community,
generate_activity_id, send_lemmy_activity, verify_is_public,
generate_activity_id,
send_lemmy_activity,
verify_is_public,
},
activity_lists::AnnouncableActivities,
insert_received_activity,

View file

@ -1,6 +1,9 @@
use crate::{
activities::{
generate_activity_id, generate_announce_activity_id, send_lemmy_activity, verify_is_public,
generate_activity_id,
generate_announce_activity_id,
send_lemmy_activity,
verify_is_public,
verify_person_in_community,
},
activity_lists::AnnouncableActivities,
@ -8,7 +11,9 @@ use crate::{
objects::community::ApubCommunity,
protocol::{
activities::community::announce::{AnnounceActivity, RawAnnouncableActivities},
Id, IdOrNestedObject, InCommunity,
Id,
IdOrNestedObject,
InCommunity,
},
};
use activitypub_federation::{

View file

@ -1,7 +1,10 @@
use crate::{
activities::{
community::send_activity_in_community, generate_activity_id, verify_is_public,
verify_mod_action, verify_person_in_community,
community::send_activity_in_community,
generate_activity_id,
verify_is_public,
verify_mod_action,
verify_person_in_community,
},
activity_lists::AnnouncableActivities,
insert_received_activity,

View file

@ -1,7 +1,10 @@
use crate::{
activities::{
community::send_activity_in_community, generate_activity_id, verify_is_public,
verify_mod_action, verify_person_in_community,
community::send_activity_in_community,
generate_activity_id,
verify_is_public,
verify_mod_action,
verify_person_in_community,
},
activity_lists::AnnouncableActivities,
insert_received_activity,

View file

@ -1,7 +1,11 @@
use crate::{
activities::{
check_community_deleted_or_removed, community::send_activity_in_community,
generate_activity_id, verify_is_public, verify_mod_action, verify_person_in_community,
check_community_deleted_or_removed,
community::send_activity_in_community,
generate_activity_id,
verify_is_public,
verify_mod_action,
verify_person_in_community,
},
activity_lists::AnnouncableActivities,
insert_received_activity,

View file

@ -1,7 +1,10 @@
use crate::{
activities::{
community::send_activity_in_community, generate_activity_id, verify_is_public,
verify_mod_action, verify_person_in_community,
community::send_activity_in_community,
generate_activity_id,
verify_is_public,
verify_mod_action,
verify_person_in_community,
},
activity_lists::AnnouncableActivities,
insert_received_activity,

View file

@ -1,7 +1,10 @@
use crate::{
activities::{
check_community_deleted_or_removed, community::send_activity_in_community,
generate_activity_id, verify_is_public, verify_person_in_community,
check_community_deleted_or_removed,
community::send_activity_in_community,
generate_activity_id,
verify_is_public,
verify_person_in_community,
},
activity_lists::AnnouncableActivities,
insert_received_activity,

View file

@ -1,7 +1,11 @@
use crate::{
activities::{
check_community_deleted_or_removed, community::send_activity_in_community,
generate_activity_id, verify_is_public, verify_mod_action, verify_person_in_community,
check_community_deleted_or_removed,
community::send_activity_in_community,
generate_activity_id,
verify_is_public,
verify_mod_action,
verify_person_in_community,
},
activity_lists::AnnouncableActivities,
insert_received_activity,

View file

@ -3,7 +3,8 @@ use crate::{
insert_received_activity,
objects::{person::ApubPerson, private_message::ApubPrivateMessage},
protocol::activities::{
create_or_update::chat_message::CreateOrUpdateChatMessage, CreateOrUpdateType,
create_or_update::chat_message::CreateOrUpdateChatMessage,
CreateOrUpdateType,
},
};
use activitypub_federation::{

View file

@ -14,8 +14,12 @@ use lemmy_db_schema::{
comment::{Comment, CommentUpdateForm},
community::{Community, CommunityUpdateForm},
moderator::{
ModRemoveComment, ModRemoveCommentForm, ModRemoveCommunity, ModRemoveCommunityForm,
ModRemovePost, ModRemovePostForm,
ModRemoveComment,
ModRemoveCommentForm,
ModRemoveCommunity,
ModRemoveCommunityForm,
ModRemovePost,
ModRemovePostForm,
},
post::{Post, PostUpdateForm},
},

View file

@ -1,11 +1,18 @@
use crate::{
activities::{
community::send_activity_in_community, send_lemmy_activity, verify_is_public,
verify_mod_action, verify_person, verify_person_in_community,
community::send_activity_in_community,
send_lemmy_activity,
verify_is_public,
verify_mod_action,
verify_person,
verify_person_in_community,
},
activity_lists::AnnouncableActivities,
objects::{
comment::ApubComment, community::ApubCommunity, person::ApubPerson, post::ApubPost,
comment::ApubComment,
community::ApubCommunity,
person::ApubPerson,
post::ApubPost,
private_message::ApubPrivateMessage,
},
protocol::{

View file

@ -14,8 +14,12 @@ use lemmy_db_schema::{
comment::{Comment, CommentUpdateForm},
community::{Community, CommunityUpdateForm},
moderator::{
ModRemoveComment, ModRemoveCommentForm, ModRemoveCommunity, ModRemoveCommunityForm,
ModRemovePost, ModRemovePostForm,
ModRemoveComment,
ModRemoveCommentForm,
ModRemoveCommunity,
ModRemoveCommunityForm,
ModRemovePost,
ModRemovePostForm,
},
post::{Post, PostUpdateForm},
},

View file

@ -1,6 +1,9 @@
use crate::{
activities::{
generate_activity_id, send_lemmy_activity, verify_person, verify_person_in_community,
generate_activity_id,
send_lemmy_activity,
verify_person,
verify_person_in_community,
},
fetcher::user_or_community::UserOrCommunity,
insert_received_activity,

View file

@ -9,8 +9,11 @@ use crate::{
},
create_or_update::private_message::send_create_or_update_pm,
deletion::{
delete_user::delete_user, send_apub_delete_in_community, send_apub_delete_in_community_new,
send_apub_delete_private_message, DeletableObjects,
delete_user::delete_user,
send_apub_delete_in_community,
send_apub_delete_in_community_new,
send_apub_delete_private_message,
DeletableObjects,
},
voting::send_like_activity,
},

View file

@ -1,6 +1,7 @@
use crate::{
activities::{
generate_activity_id, verify_person_in_community,
generate_activity_id,
verify_person_in_community,
voting::{undo_vote_comment, undo_vote_post},
},
insert_received_activity,

View file

@ -1,6 +1,7 @@
use crate::{
activities::{
generate_activity_id, verify_person_in_community,
generate_activity_id,
verify_person_in_community,
voting::{vote_comment, vote_post},
},
insert_received_activity,

View file

@ -12,7 +12,9 @@ use crate::{
update::UpdateCommunity,
},
create_or_update::{
chat_message::CreateOrUpdateChatMessage, note::CreateOrUpdateNote, page::CreateOrUpdatePage,
chat_message::CreateOrUpdateChatMessage,
note::CreateOrUpdateNote,
page::CreateOrUpdatePage,
},
deletion::{delete::Delete, delete_user::DeleteUser, undo_delete::UndoDelete},
following::{accept::AcceptFollow, follow::Follow, undo_follow::UndoFollow},

View file

@ -1,5 +1,6 @@
use crate::{
api::listing_type_with_default, fetcher::resolve_actor_identifier,
api::listing_type_with_default,
fetcher::resolve_actor_identifier,
objects::community::ApubCommunity,
};
use activitypub_federation::config::Data;

View file

@ -1,5 +1,6 @@
use crate::{
api::listing_type_with_default, fetcher::resolve_actor_identifier,
api::listing_type_with_default,
fetcher::resolve_actor_identifier,
objects::community::ApubCommunity,
};
use activitypub_federation::config::Data;

View file

@ -7,7 +7,10 @@ use lemmy_api_common::{
utils::{check_private_instance, is_mod_or_admin_opt},
};
use lemmy_db_schema::source::{
actor_language::CommunityLanguage, community::Community, local_site::LocalSite, site::Site,
actor_language::CommunityLanguage,
community::Community,
local_site::LocalSite,
site::Site,
};
use lemmy_db_views::structs::LocalUserView;
use lemmy_db_views_actor::structs::{CommunityModeratorView, CommunityView};

View file

@ -1,5 +1,7 @@
use crate::fetcher::search::{
search_query_to_object_id, search_query_to_object_id_local, SearchableObjects,
search_query_to_object_id,
search_query_to_object_id_local,
SearchableObjects,
};
use activitypub_federation::config::Data;
use actix_web::web::{Json, Query};

View file

@ -3,8 +3,11 @@ use crate::{
protocol::collections::group_moderators::GroupModerators,
};
use activitypub_federation::{
config::Data, fetch::object_id::ObjectId, kinds::collection::OrderedCollectionType,
protocol::verification::verify_domains_match, traits::Collection,
config::Data,
fetch::object_id::ObjectId,
kinds::collection::OrderedCollectionType,
protocol::verification::verify_domains_match,
traits::Collection,
};
use lemmy_api_common::{context::LemmyContext, utils::generate_moderators_url};
use lemmy_db_schema::{
@ -105,7 +108,8 @@ mod tests {
use super::*;
use crate::{
objects::{
community::tests::parse_lemmy_community, person::tests::parse_lemmy_person,
community::tests::parse_lemmy_community,
person::tests::parse_lemmy_person,
tests::init_context,
},
protocol::tests::file_to_json_object,

View file

@ -3,7 +3,8 @@ use crate::{
objects::{community::ApubCommunity, post::ApubPost},
protocol::{
activities::{
community::announce::AnnounceActivity, create_or_update::page::CreateOrUpdatePage,
community::announce::AnnounceActivity,
create_or_update::page::CreateOrUpdatePage,
CreateOrUpdateType,
},
collections::group_outbox::GroupOutbox,

View file

@ -1,7 +1,8 @@
use crate::{
activity_lists::GroupInboxActivities,
collections::{
community_featured::ApubCommunityFeatured, community_moderators::ApubCommunityModerators,
community_featured::ApubCommunityFeatured,
community_moderators::ApubCommunityModerators,
community_outbox::ApubCommunityOutbox,
},
http::{create_apub_response, create_apub_tombstone_response},

View file

@ -1,9 +1,13 @@
use crate::{
activity_lists::SharedInboxActivities, fetcher::user_or_community::UserOrCommunity,
protocol::objects::tombstone::Tombstone, CONTEXT,
activity_lists::SharedInboxActivities,
fetcher::user_or_community::UserOrCommunity,
protocol::objects::tombstone::Tombstone,
CONTEXT,
};
use activitypub_federation::{
actix_web::inbox::receive_activity, config::Data, protocol::context::WithContext,
actix_web::inbox::receive_activity,
config::Data,
protocol::context::WithContext,
FEDERATION_CONTENT_TYPE,
};
use actix_web::{web, web::Bytes, HttpRequest, HttpResponse};

View file

@ -6,7 +6,10 @@ use crate::{
protocol::collections::empty_outbox::EmptyOutbox,
};
use activitypub_federation::{
actix_web::inbox::receive_activity, config::Data, protocol::context::WithContext, traits::Object,
actix_web::inbox::receive_activity,
config::Data,
protocol::context::WithContext,
traits::Object,
};
use actix_web::{web, web::Bytes, HttpRequest, HttpResponse};
use lemmy_api_common::{context::LemmyContext, utils::generate_outbox_url};

View file

@ -1,8 +1,12 @@
use crate::http::{
comment::get_apub_comment,
community::{
community_inbox, get_apub_community_featured, get_apub_community_followers,
get_apub_community_http, get_apub_community_moderators, get_apub_community_outbox,
community_inbox,
get_apub_community_featured,
get_apub_community_followers,
get_apub_community_http,
get_apub_community_moderators,
get_apub_community_outbox,
},
get_activity,
person::{get_apub_person_http, get_apub_person_outbox, person_inbox},

View file

@ -5,7 +5,10 @@ use crate::{
protocol::collections::empty_outbox::EmptyOutbox,
};
use activitypub_federation::{
actix_web::inbox::receive_activity, config::Data, protocol::context::WithContext, traits::Object,
actix_web::inbox::receive_activity,
config::Data,
protocol::context::WithContext,
traits::Object,
};
use actix_web::{web::Bytes, HttpRequest, HttpResponse};
use lemmy_api_common::context::LemmyContext;

View file

@ -5,7 +5,8 @@ use crate::{
objects::{read_from_string_or_source, verify_is_remote_object},
protocol::{
objects::{note::Note, LanguageTag},
InCommunity, Source,
InCommunity,
Source,
},
};
use activitypub_federation::{

View file

@ -1,10 +1,12 @@
use crate::{
activities::GetActorType,
check_apub_id_valid, local_site_data_cached,
check_apub_id_valid,
local_site_data_cached,
objects::instance::fetch_instance_actor_for_object,
protocol::{
objects::{group::Group, Endpoints, LanguageTag},
ImageObject, Source,
ImageObject,
Source,
},
};
use activitypub_federation::{

View file

@ -1,10 +1,12 @@
use crate::{
activities::GetActorType,
check_apub_id_valid_with_strictness, local_site_data_cached,
check_apub_id_valid_with_strictness,
local_site_data_cached,
objects::read_from_string_or_source_opt,
protocol::{
objects::{instance::Instance, LanguageTag},
ImageObject, Source,
ImageObject,
Source,
},
};
use activitypub_federation::{

View file

@ -1,13 +1,15 @@
use crate::{
activities::GetActorType,
check_apub_id_valid_with_strictness, local_site_data_cached,
check_apub_id_valid_with_strictness,
local_site_data_cached,
objects::{instance::fetch_instance_actor_for_object, read_from_string_or_source_opt},
protocol::{
objects::{
person::{Person, UserTypes},
Endpoints,
},
ImageObject, Source,
ImageObject,
Source,
},
};
use activitypub_federation::{
@ -19,7 +21,9 @@ use chrono::{DateTime, Utc};
use lemmy_api_common::{
context::LemmyContext,
utils::{
generate_outbox_url, local_site_opt_to_slur_regex, sanitize_html_federation,
generate_outbox_url,
local_site_opt_to_slur_regex,
sanitize_html_federation,
sanitize_html_federation_opt,
},
};

View file

@ -1,13 +1,16 @@
use crate::{
activities::{verify_is_public, verify_person_in_community},
check_apub_id_valid_with_strictness, local_site_data_cached,
check_apub_id_valid_with_strictness,
local_site_data_cached,
objects::{read_from_string_or_source_opt, verify_is_remote_object},
protocol::{
objects::{
page::{Attachment, AttributedTo, Page, PageType},
LanguageTag,
},
ImageObject, InCommunity, Source,
ImageObject,
InCommunity,
Source,
},
};
use activitypub_federation::{
@ -23,8 +26,11 @@ use lemmy_api_common::{
context::LemmyContext,
request::fetch_site_data,
utils::{
is_mod_or_admin, local_site_opt_to_sensitive, local_site_opt_to_slur_regex,
sanitize_html_federation, sanitize_html_federation_opt,
is_mod_or_admin,
local_site_opt_to_sensitive,
local_site_opt_to_slur_regex,
sanitize_html_federation,
sanitize_html_federation_opt,
},
};
use lemmy_db_schema::{
@ -294,7 +300,9 @@ mod tests {
use super::*;
use crate::{
objects::{
community::tests::parse_lemmy_community, person::tests::parse_lemmy_person, post::ApubPost,
community::tests::parse_lemmy_community,
person::tests::parse_lemmy_person,
post::ApubPost,
tests::init_context,
},
protocol::tests::file_to_json_object,

View file

@ -4,7 +4,9 @@ use crate::{
protocol::InCommunity,
};
use activitypub_federation::{
config::Data, fetch::object_id::ObjectId, kinds::activity::BlockType,
config::Data,
fetch::object_id::ObjectId,
kinds::activity::BlockType,
protocol::helpers::deserialize_one_or_many,
};
use anyhow::anyhow;

View file

@ -4,7 +4,9 @@ use crate::{
protocol::{activities::block::block_user::BlockUser, InCommunity},
};
use activitypub_federation::{
config::Data, fetch::object_id::ObjectId, kinds::activity::UndoType,
config::Data,
fetch::object_id::ObjectId,
kinds::activity::UndoType,
protocol::helpers::deserialize_one_or_many,
};
use lemmy_api_common::context::LemmyContext;

View file

@ -1,6 +1,7 @@
use crate::{objects::community::ApubCommunity, protocol::IdOrNestedObject};
use activitypub_federation::{
fetch::object_id::ObjectId, kinds::activity::AnnounceType,
fetch::object_id::ObjectId,
kinds::activity::AnnounceType,
protocol::helpers::deserialize_one_or_many,
};
use serde::{Deserialize, Serialize};

View file

@ -4,7 +4,9 @@ use crate::{
protocol::InCommunity,
};
use activitypub_federation::{
config::Data, fetch::object_id::ObjectId, kinds::activity::AddType,
config::Data,
fetch::object_id::ObjectId,
kinds::activity::AddType,
protocol::helpers::deserialize_one_or_many,
};
use lemmy_api_common::context::LemmyContext;

View file

@ -4,7 +4,9 @@ use crate::{
protocol::InCommunity,
};
use activitypub_federation::{
config::Data, fetch::object_id::ObjectId, kinds::activity::RemoveType,
config::Data,
fetch::object_id::ObjectId,
kinds::activity::RemoveType,
protocol::helpers::deserialize_one_or_many,
};
use lemmy_api_common::context::LemmyContext;

View file

@ -4,7 +4,9 @@ use crate::{
protocol::InCommunity,
};
use activitypub_federation::{
config::Data, fetch::object_id::ObjectId, kinds::activity::UndoType,
config::Data,
fetch::object_id::ObjectId,
kinds::activity::UndoType,
protocol::helpers::deserialize_one_or_many,
};
use lemmy_api_common::context::LemmyContext;

View file

@ -5,7 +5,9 @@ use crate::{
protocol::InCommunity,
};
use activitypub_federation::{
config::Data, fetch::object_id::ObjectId, kinds::activity::FlagType,
config::Data,
fetch::object_id::ObjectId,
kinds::activity::FlagType,
protocol::helpers::deserialize_one,
};
use lemmy_api_common::context::LemmyContext;

View file

@ -4,7 +4,9 @@ use crate::{
protocol::{objects::group::Group, InCommunity},
};
use activitypub_federation::{
config::Data, fetch::object_id::ObjectId, kinds::activity::UpdateType,
config::Data,
fetch::object_id::ObjectId,
kinds::activity::UpdateType,
protocol::helpers::deserialize_one_or_many,
};
use lemmy_api_common::context::LemmyContext;

View file

@ -9,7 +9,9 @@ mod tests {
use crate::protocol::{
activities::create_or_update::{
chat_message::CreateOrUpdateChatMessage, note::CreateOrUpdateNote, page::CreateOrUpdatePage,
chat_message::CreateOrUpdateChatMessage,
note::CreateOrUpdateNote,
page::CreateOrUpdatePage,
},
tests::test_parse_lemmy_item,
};

View file

@ -5,7 +5,9 @@ use crate::{
protocol::{activities::CreateOrUpdateType, objects::note::Note, InCommunity},
};
use activitypub_federation::{
config::Data, fetch::object_id::ObjectId, protocol::helpers::deserialize_one_or_many,
config::Data,
fetch::object_id::ObjectId,
protocol::helpers::deserialize_one_or_many,
};
use lemmy_api_common::context::LemmyContext;
use lemmy_db_schema::{source::community::Community, traits::Crud};

View file

@ -4,7 +4,9 @@ use crate::{
protocol::{activities::CreateOrUpdateType, objects::page::Page, InCommunity},
};
use activitypub_federation::{
config::Data, fetch::object_id::ObjectId, protocol::helpers::deserialize_one_or_many,
config::Data,
fetch::object_id::ObjectId,
protocol::helpers::deserialize_one_or_many,
};
use lemmy_api_common::context::LemmyContext;
use lemmy_utils::error::LemmyError;

View file

@ -4,7 +4,9 @@ use crate::{
protocol::{objects::tombstone::Tombstone, IdOrNestedObject, InCommunity},
};
use activitypub_federation::{
config::Data, fetch::object_id::ObjectId, kinds::activity::DeleteType,
config::Data,
fetch::object_id::ObjectId,
kinds::activity::DeleteType,
protocol::helpers::deserialize_one_or_many,
};
use anyhow::anyhow;

View file

@ -1,6 +1,7 @@
use crate::objects::person::ApubPerson;
use activitypub_federation::{
fetch::object_id::ObjectId, kinds::activity::DeleteType,
fetch::object_id::ObjectId,
kinds::activity::DeleteType,
protocol::helpers::deserialize_one_or_many,
};
use serde::{Deserialize, Serialize};

View file

@ -4,7 +4,9 @@ use crate::{
protocol::{activities::deletion::delete::Delete, InCommunity},
};
use activitypub_federation::{
config::Data, fetch::object_id::ObjectId, kinds::activity::UndoType,
config::Data,
fetch::object_id::ObjectId,
kinds::activity::UndoType,
protocol::helpers::deserialize_one_or_many,
};
use lemmy_api_common::context::LemmyContext;

View file

@ -3,7 +3,8 @@ use crate::{
protocol::activities::following::follow::Follow,
};
use activitypub_federation::{
fetch::object_id::ObjectId, kinds::activity::AcceptType,
fetch::object_id::ObjectId,
kinds::activity::AcceptType,
protocol::helpers::deserialize_skip_error,
};
use serde::{Deserialize, Serialize};

View file

@ -1,6 +1,7 @@
use crate::{fetcher::user_or_community::UserOrCommunity, objects::person::ApubPerson};
use activitypub_federation::{
fetch::object_id::ObjectId, kinds::activity::FollowType,
fetch::object_id::ObjectId,
kinds::activity::FollowType,
protocol::helpers::deserialize_skip_error,
};
use serde::{Deserialize, Serialize};

View file

@ -1,6 +1,8 @@
use crate::{objects::person::ApubPerson, protocol::activities::following::follow::Follow};
use activitypub_federation::{
fetch::object_id::ObjectId, kinds::activity::UndoType, protocol::helpers::deserialize_skip_error,
fetch::object_id::ObjectId,
kinds::activity::UndoType,
protocol::helpers::deserialize_skip_error,
};
use serde::{Deserialize, Serialize};
use url::Url;

View file

@ -1,6 +1,7 @@
use crate::objects::person::ApubPerson;
use activitypub_federation::{
fetch::object_id::ObjectId, kinds::collection::OrderedCollectionType,
fetch::object_id::ObjectId,
kinds::collection::OrderedCollectionType,
};
use serde::{Deserialize, Serialize};
use url::Url;

View file

@ -11,8 +11,11 @@ mod tests {
use crate::protocol::{
collections::{
empty_outbox::EmptyOutbox, group_featured::GroupFeatured, group_followers::GroupFollowers,
group_moderators::GroupModerators, group_outbox::GroupOutbox,
empty_outbox::EmptyOutbox,
group_featured::GroupFeatured,
group_followers::GroupFollowers,
group_moderators::GroupModerators,
group_outbox::GroupOutbox,
},
tests::{test_json, test_parse_lemmy_item},
};

View file

@ -1,6 +1,8 @@
use crate::objects::community::ApubCommunity;
use activitypub_federation::{
config::Data, fetch::fetch_object_http, kinds::object::ImageType,
config::Data,
fetch::fetch_object_http,
kinds::object::ImageType,
protocol::values::MediaTypeMarkdown,
};
use lemmy_api_common::context::LemmyContext;

View file

@ -1,21 +1,25 @@
use crate::{
check_apub_id_valid_with_strictness,
collections::{
community_featured::ApubCommunityFeatured, community_moderators::ApubCommunityModerators,
community_featured::ApubCommunityFeatured,
community_moderators::ApubCommunityModerators,
community_outbox::ApubCommunityOutbox,
},
local_site_data_cached,
objects::{community::ApubCommunity, read_from_string_or_source_opt},
protocol::{
objects::{Endpoints, LanguageTag},
ImageObject, Source,
ImageObject,
Source,
},
};
use activitypub_federation::{
fetch::{collection_id::CollectionId, object_id::ObjectId},
kinds::actor::GroupType,
protocol::{
helpers::deserialize_skip_error, public_key::PublicKey, verification::verify_domains_match,
helpers::deserialize_skip_error,
public_key::PublicKey,
verification::verify_domains_match,
},
};
use chrono::{DateTime, Utc};

View file

@ -1,5 +1,7 @@
use lemmy_db_schema::{
impls::actor_language::UNDETERMINED_ID, newtypes::LanguageId, source::language::Language,
impls::actor_language::UNDETERMINED_ID,
newtypes::LanguageId,
source::language::Language,
utils::DbPool,
};
use lemmy_utils::error::LemmyError;
@ -98,8 +100,13 @@ mod tests {
use crate::protocol::{
objects::{
chat_message::ChatMessage, group::Group, instance::Instance, note::Note, page::Page,
person::Person, tombstone::Tombstone,
chat_message::ChatMessage,
group::Group,
instance::Instance,
note::Note,
page::Page,
person::Person,
tombstone::Tombstone,
},
tests::{test_json, test_parse_lemmy_item},
};

View file

@ -4,7 +4,8 @@ use crate::{
schema::{community_aggregates, post, post_aggregates},
utils::{
functions::{hot_rank, scaled_rank},
get_conn, DbPool,
get_conn,
DbPool,
},
};
use diesel::{result::Error, ExpressionMethods, JoinOnDsl, QueryDsl};

View file

@ -1,8 +1,12 @@
use crate::newtypes::{CommentId, CommunityId, InstanceId, PersonId, PostId, SiteId};
#[cfg(feature = "full")]
use crate::schema::{
comment_aggregates, community_aggregates, person_aggregates, person_post_aggregates,
post_aggregates, site_aggregates,
comment_aggregates,
community_aggregates,
person_aggregates,
person_post_aggregates,
post_aggregates,
site_aggregates,
};
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};

View file

@ -7,7 +7,8 @@ use crate::{
use diesel::{
dsl::insert_into,
result::{DatabaseErrorKind, Error, Error::DatabaseError},
ExpressionMethods, QueryDsl,
ExpressionMethods,
QueryDsl,
};
use diesel_async::RunQueryDsl;

View file

@ -4,8 +4,12 @@ use crate::{
schema::{local_site, site, site_language},
source::{
actor_language::{
CommunityLanguage, CommunityLanguageForm, LocalUserLanguage, LocalUserLanguageForm,
SiteLanguage, SiteLanguageForm,
CommunityLanguage,
CommunityLanguageForm,
LocalUserLanguage,
LocalUserLanguageForm,
SiteLanguage,
SiteLanguageForm,
},
language::Language,
site::Site,
@ -17,7 +21,9 @@ use diesel::{
dsl::{count, exists},
insert_into,
result::Error,
select, ExpressionMethods, QueryDsl,
select,
ExpressionMethods,
QueryDsl,
};
use diesel_async::{AsyncPgConnection, RunQueryDsl};
use lemmy_utils::error::{LemmyError, LemmyErrorType};
@ -31,7 +37,9 @@ impl LocalUserLanguage {
for_local_user_id: LocalUserId,
) -> Result<Vec<LanguageId>, Error> {
use crate::schema::local_user_language::dsl::{
language_id, local_user_id, local_user_language,
language_id,
local_user_id,
local_user_language,
};
let conn = &mut get_conn(pool).await?;
@ -214,7 +222,9 @@ impl CommunityLanguage {
for_instance_id: InstanceId,
) -> Result<(), Error> {
use crate::schema::{
community::dsl as c, community_language::dsl as cl, site_language::dsl as sl,
community::dsl as c,
community_language::dsl as cl,
site_language::dsl as sl,
};
let community_languages: Vec<LanguageId> = cl::community_language
.left_outer_join(sl::site_language.on(cl::language_id.eq(sl::language_id)))
@ -380,8 +390,17 @@ mod tests {
use super::*;
use crate::{
impls::actor_language::{
convert_read_languages, convert_update_languages, default_post_language, get_conn,
CommunityLanguage, DbPool, Language, LanguageId, LocalUserLanguage, QueryDsl, RunQueryDsl,
convert_read_languages,
convert_update_languages,
default_post_language,
get_conn,
CommunityLanguage,
DbPool,
Language,
LanguageId,
LocalUserLanguage,
QueryDsl,
RunQueryDsl,
SiteLanguage,
},
source::{

View file

@ -4,7 +4,13 @@ use crate::{
utils::{functions::lower, get_conn, DbPool},
};
use diesel::{
delete, dsl::exists, insert_into, result::Error, select, ExpressionMethods, QueryDsl,
delete,
dsl::exists,
insert_into,
result::Error,
select,
ExpressionMethods,
QueryDsl,
};
use diesel_async::RunQueryDsl;

View file

@ -2,7 +2,12 @@ use crate::{
newtypes::{CommentId, DbUrl, PersonId},
schema::comment::dsl::{ap_id, comment, content, creator_id, deleted, path, removed, updated},
source::comment::{
Comment, CommentInsertForm, CommentLike, CommentLikeForm, CommentSaved, CommentSavedForm,
Comment,
CommentInsertForm,
CommentLike,
CommentLikeForm,
CommentSaved,
CommentSavedForm,
CommentUpdateForm,
},
traits::{Crud, Likeable, Saveable},
@ -11,7 +16,8 @@ use crate::{
use diesel::{
dsl::{insert_into, sql_query},
result::Error,
ExpressionMethods, QueryDsl,
ExpressionMethods,
QueryDsl,
};
use diesel_async::RunQueryDsl;
use diesel_ltree::Ltree;
@ -243,7 +249,12 @@ mod tests {
newtypes::LanguageId,
source::{
comment::{
Comment, CommentInsertForm, CommentLike, CommentLikeForm, CommentSaved, CommentSavedForm,
Comment,
CommentInsertForm,
CommentLike,
CommentLikeForm,
CommentSaved,
CommentSavedForm,
CommentUpdateForm,
},
community::{Community, CommunityInsertForm},

View file

@ -8,7 +8,8 @@ use crate::{
use diesel::{
dsl::{insert_into, update},
result::Error,
ExpressionMethods, QueryDsl,
ExpressionMethods,
QueryDsl,
};
use diesel_async::RunQueryDsl;

View file

@ -4,8 +4,15 @@ use crate::{
source::{
actor_language::CommunityLanguage,
community::{
Community, CommunityFollower, CommunityFollowerForm, CommunityInsertForm, CommunityModerator,
CommunityModeratorForm, CommunityPersonBan, CommunityPersonBanForm, CommunityUpdateForm,
Community,
CommunityFollower,
CommunityFollowerForm,
CommunityInsertForm,
CommunityModerator,
CommunityModeratorForm,
CommunityPersonBan,
CommunityPersonBanForm,
CommunityUpdateForm,
},
},
traits::{ApubActor, Bannable, Crud, Followable, Joinable},
@ -13,8 +20,16 @@ use crate::{
SubscribedType,
};
use diesel::{
deserialize, dsl, dsl::insert_into, pg::Pg, result::Error, sql_types, ExpressionMethods,
NullableExpressionMethods, QueryDsl, Queryable,
deserialize,
dsl,
dsl::insert_into,
pg::Pg,
result::Error,
sql_types,
ExpressionMethods,
NullableExpressionMethods,
QueryDsl,
Queryable,
};
use diesel_async::RunQueryDsl;
@ -247,7 +262,10 @@ impl Followable for CommunityFollower {
person_id_: PersonId,
) -> Result<Self, Error> {
use crate::schema::community_follower::dsl::{
community_follower, community_id, pending, person_id,
community_follower,
community_id,
pending,
person_id,
};
let conn = &mut get_conn(pool).await?;
diesel::update(
@ -331,8 +349,14 @@ mod tests {
use crate::{
source::{
community::{
Community, CommunityFollower, CommunityFollowerForm, CommunityInsertForm,
CommunityModerator, CommunityModeratorForm, CommunityPersonBan, CommunityPersonBanForm,
Community,
CommunityFollower,
CommunityFollowerForm,
CommunityInsertForm,
CommunityModerator,
CommunityModeratorForm,
CommunityPersonBan,
CommunityPersonBanForm,
CommunityUpdateForm,
},
instance::Instance,

View file

@ -1,7 +1,10 @@
use crate::{
newtypes::LocalUserId,
schema::email_verification::dsl::{
email_verification, local_user_id, published, verification_token,
email_verification,
local_user_id,
published,
verification_token,
},
source::email_verification::{EmailVerification, EmailVerificationForm},
utils::{get_conn, DbPool},
@ -11,7 +14,9 @@ use diesel::{
insert_into,
result::Error,
sql_types::Timestamptz,
ExpressionMethods, IntoSql, QueryDsl,
ExpressionMethods,
IntoSql,
QueryDsl,
};
use diesel_async::RunQueryDsl;

View file

@ -9,7 +9,10 @@ use diesel::{
dsl::{count_star, insert_into},
result::Error,
sql_types::{Nullable, Timestamptz},
ExpressionMethods, NullableExpressionMethods, QueryDsl, SelectableHelper,
ExpressionMethods,
NullableExpressionMethods,
QueryDsl,
SelectableHelper,
};
use diesel_async::RunQueryDsl;

View file

@ -1,7 +1,9 @@
use crate::{
schema::local_site_rate_limit,
source::local_site_rate_limit::{
LocalSiteRateLimit, LocalSiteRateLimitInsertForm, LocalSiteRateLimitUpdateForm,
LocalSiteRateLimit,
LocalSiteRateLimitInsertForm,
LocalSiteRateLimitUpdateForm,
},
utils::{get_conn, DbPool},
};

View file

@ -1,7 +1,12 @@
use crate::{
newtypes::LocalUserId,
schema::local_user::dsl::{
accepted_application, email, email_verified, local_user, password_encrypted, validator_time,
accepted_application,
email,
email_verified,
local_user,
password_encrypted,
validator_time,
},
source::{
actor_language::{LocalUserLanguage, SiteLanguage},

View file

@ -1,12 +1,35 @@
use crate::{
source::moderator::{
AdminPurgeComment, AdminPurgeCommentForm, AdminPurgeCommunity, AdminPurgeCommunityForm,
AdminPurgePerson, AdminPurgePersonForm, AdminPurgePost, AdminPurgePostForm, ModAdd,
ModAddCommunity, ModAddCommunityForm, ModAddForm, ModBan, ModBanForm, ModBanFromCommunity,
ModBanFromCommunityForm, ModFeaturePost, ModFeaturePostForm, ModHideCommunity,
ModHideCommunityForm, ModLockPost, ModLockPostForm, ModRemoveComment, ModRemoveCommentForm,
ModRemoveCommunity, ModRemoveCommunityForm, ModRemovePost, ModRemovePostForm,
ModTransferCommunity, ModTransferCommunityForm,
AdminPurgeComment,
AdminPurgeCommentForm,
AdminPurgeCommunity,
AdminPurgeCommunityForm,
AdminPurgePerson,
AdminPurgePersonForm,
AdminPurgePost,
AdminPurgePostForm,
ModAdd,
ModAddCommunity,
ModAddCommunityForm,
ModAddForm,
ModBan,
ModBanForm,
ModBanFromCommunity,
ModBanFromCommunityForm,
ModFeaturePost,
ModFeaturePostForm,
ModHideCommunity,
ModHideCommunityForm,
ModLockPost,
ModLockPostForm,
ModRemoveComment,
ModRemoveCommentForm,
ModRemoveCommunity,
ModRemoveCommunityForm,
ModRemovePost,
ModRemovePostForm,
ModTransferCommunity,
ModTransferCommunityForm,
},
traits::Crud,
utils::{get_conn, DbPool},
@ -452,10 +475,24 @@ mod tests {
community::{Community, CommunityInsertForm},
instance::Instance,
moderator::{
ModAdd, ModAddCommunity, ModAddCommunityForm, ModAddForm, ModBan, ModBanForm,
ModBanFromCommunity, ModBanFromCommunityForm, ModFeaturePost, ModFeaturePostForm,
ModLockPost, ModLockPostForm, ModRemoveComment, ModRemoveCommentForm, ModRemoveCommunity,
ModRemoveCommunityForm, ModRemovePost, ModRemovePostForm,
ModAdd,
ModAddCommunity,
ModAddCommunityForm,
ModAddForm,
ModBan,
ModBanForm,
ModBanFromCommunity,
ModBanFromCommunityForm,
ModFeaturePost,
ModFeaturePostForm,
ModLockPost,
ModLockPostForm,
ModRemoveComment,
ModRemoveCommentForm,
ModRemoveCommunity,
ModRemoveCommunityForm,
ModRemovePost,
ModRemovePostForm,
},
person::{Person, PersonInsertForm},
post::{Post, PostInsertForm},

View file

@ -9,7 +9,9 @@ use diesel::{
dsl::{insert_into, now, IntervalDsl},
result::Error,
sql_types::Timestamptz,
ExpressionMethods, IntoSql, QueryDsl,
ExpressionMethods,
IntoSql,
QueryDsl,
};
use diesel_async::RunQueryDsl;

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