From 37655f0f18ed0c4f43f60918ee0d1b5854864047 Mon Sep 17 00:00:00 2001 From: SleeplessOne1917 Date: Fri, 22 Sep 2023 21:39:03 -0400 Subject: [PATCH] chore: Run rust format --- crates/api/src/community/ban.rs | 5 +- .../local_user/change_password_after_reset.rs | 3 +- .../src/local_user/generate_totp_secret.rs | 4 +- .../local_user/notifications/mark_all_read.rs | 4 +- crates/api/src/local_user/report_count.rs | 5 +- crates/api/src/post/like.rs | 4 +- crates/api/src/private_message_report/list.rs | 3 +- crates/api/src/site/federated_instances.rs | 4 +- crates/api/src/site/mod_log.rs | 20 +---- .../site/registration_applications/list.rs | 3 +- .../registration_applications/unread_count.rs | 4 +- crates/api_common/src/comment.rs | 3 +- crates/api_common/src/community.rs | 3 +- crates/api_common/src/person.rs | 9 +-- crates/api_common/src/post.rs | 4 +- crates/api_common/src/request.rs | 5 +- crates/api_common/src/send_activity.rs | 5 +- crates/api_common/src/site.rs | 41 ++-------- crates/api_common/src/utils.rs | 4 +- crates/api_crud/src/comment/create.rs | 13 +--- crates/api_crud/src/comment/update.rs | 4 +- crates/api_crud/src/community/create.rs | 18 +---- crates/api_crud/src/post/create.rs | 12 +-- crates/api_crud/src/private_message/create.rs | 9 +-- crates/api_crud/src/site/create.rs | 14 +--- crates/api_crud/src/site/read.rs | 8 +- crates/api_crud/src/site/update.rs | 7 +- crates/api_crud/src/user/create.rs | 14 +--- .../apub/src/activities/block/block_user.rs | 10 +-- .../src/activities/block/undo_block_user.rs | 4 +- .../apub/src/activities/community/announce.rs | 9 +-- .../activities/community/collection_add.rs | 7 +- .../activities/community/collection_remove.rs | 7 +- .../src/activities/community/lock_page.rs | 8 +- .../apub/src/activities/community/update.rs | 7 +- .../activities/create_or_update/comment.rs | 7 +- .../src/activities/create_or_update/post.rs | 8 +- .../create_or_update/private_message.rs | 3 +- crates/apub/src/activities/deletion/delete.rs | 8 +- crates/apub/src/activities/deletion/mod.rs | 13 +--- .../src/activities/deletion/undo_delete.rs | 8 +- .../apub/src/activities/following/follow.rs | 5 +- crates/apub/src/activities/mod.rs | 7 +- .../apub/src/activities/voting/undo_vote.rs | 3 +- crates/apub/src/activities/voting/vote.rs | 3 +- crates/apub/src/activity_lists.rs | 4 +- crates/apub/src/api/list_comments.rs | 3 +- crates/apub/src/api/list_posts.rs | 3 +- crates/apub/src/api/read_community.rs | 5 +- crates/apub/src/api/resolve_object.rs | 4 +- .../src/collections/community_moderators.rs | 10 +-- .../apub/src/collections/community_outbox.rs | 3 +- crates/apub/src/http/community.rs | 3 +- crates/apub/src/http/mod.rs | 10 +-- crates/apub/src/http/person.rs | 5 +- crates/apub/src/http/routes.rs | 8 +- crates/apub/src/http/site.rs | 5 +- crates/apub/src/objects/comment.rs | 3 +- crates/apub/src/objects/community.rs | 6 +- crates/apub/src/objects/instance.rs | 6 +- crates/apub/src/objects/person.rs | 10 +-- crates/apub/src/objects/post.rs | 18 ++--- .../protocol/activities/block/block_user.rs | 4 +- .../activities/block/undo_block_user.rs | 4 +- .../protocol/activities/community/announce.rs | 3 +- .../activities/community/collection_add.rs | 4 +- .../activities/community/collection_remove.rs | 4 +- .../activities/community/lock_page.rs | 4 +- .../protocol/activities/community/report.rs | 4 +- .../protocol/activities/community/update.rs | 4 +- .../activities/create_or_update/mod.rs | 4 +- .../activities/create_or_update/note.rs | 4 +- .../activities/create_or_update/page.rs | 4 +- .../protocol/activities/deletion/delete.rs | 4 +- .../activities/deletion/delete_user.rs | 3 +- .../activities/deletion/undo_delete.rs | 4 +- .../protocol/activities/following/accept.rs | 3 +- .../protocol/activities/following/follow.rs | 3 +- .../activities/following/undo_follow.rs | 4 +- .../protocol/collections/group_moderators.rs | 3 +- crates/apub/src/protocol/collections/mod.rs | 7 +- crates/apub/src/protocol/mod.rs | 4 +- crates/apub/src/protocol/objects/group.rs | 10 +-- crates/apub/src/protocol/objects/mod.rs | 13 +--- .../src/aggregates/post_aggregates.rs | 3 +- crates/db_schema/src/aggregates/structs.rs | 8 +- crates/db_schema/src/impls/activity.rs | 3 +- crates/db_schema/src/impls/actor_language.rs | 33 ++------ crates/db_schema/src/impls/captcha_answer.rs | 8 +- crates/db_schema/src/impls/comment.rs | 17 +--- crates/db_schema/src/impls/comment_report.rs | 3 +- crates/db_schema/src/impls/community.rs | 38 ++------- .../db_schema/src/impls/email_verification.rs | 9 +-- crates/db_schema/src/impls/instance.rs | 5 +- .../src/impls/local_site_rate_limit.rs | 4 +- crates/db_schema/src/impls/local_user.rs | 7 +- crates/db_schema/src/impls/moderator.rs | 59 +++----------- .../src/impls/password_reset_request.rs | 4 +- crates/db_schema/src/impls/person.rs | 6 +- crates/db_schema/src/impls/post.rs | 36 ++------- crates/db_schema/src/impls/post_report.rs | 3 +- .../src/impls/private_message_report.rs | 3 +- .../src/impls/registration_application.rs | 4 +- crates/db_schema/src/newtypes.rs | 4 +- crates/db_schema/src/source/actor_language.rs | 7 +- crates/db_schema/src/source/local_site.rs | 3 +- crates/db_schema/src/source/local_user.rs | 4 +- crates/db_schema/src/source/moderator.rs | 18 +---- crates/db_schema/src/traits.rs | 3 +- crates/db_schema/src/utils.rs | 11 +-- crates/db_views/src/comment_report_view.rs | 21 +---- crates/db_views/src/comment_view.rs | 30 ++----- crates/db_views/src/post_report_view.rs | 17 +--- crates/db_views/src/post_view.rs | 47 +++-------- .../src/private_message_report_view.rs | 7 +- crates/db_views/src/private_message_view.rs | 8 +- .../src/registration_application_view.rs | 13 +--- crates/db_views/src/structs.rs | 19 ++--- .../db_views_actor/src/comment_reply_view.rs | 22 +----- .../src/community_follower_view.rs | 3 +- .../src/community_moderator_view.rs | 4 +- crates/db_views_actor/src/community_view.rs | 19 +---- .../db_views_actor/src/person_mention_view.rs | 23 +----- crates/db_views_actor/src/person_view.rs | 9 +-- crates/db_views_actor/src/structs.rs | 10 +-- .../src/admin_purge_comment_view.rs | 9 +-- .../src/admin_purge_community_view.rs | 9 +-- .../src/admin_purge_person_view.rs | 9 +-- .../src/admin_purge_post_view.rs | 9 +-- .../src/mod_add_community_view.rs | 9 +-- crates/db_views_moderator/src/mod_add_view.rs | 9 +-- .../src/mod_ban_from_community_view.rs | 9 +-- crates/db_views_moderator/src/mod_ban_view.rs | 9 +-- .../src/mod_feature_post_view.rs | 9 +-- .../src/mod_hide_community_view.rs | 9 +-- .../src/mod_lock_post_view.rs | 9 +-- .../src/mod_remove_comment_view.rs | 9 +-- .../src/mod_remove_community_view.rs | 9 +-- .../src/mod_remove_post_view.rs | 9 +-- .../src/mod_transfer_community_view.rs | 9 +-- crates/db_views_moderator/src/structs.rs | 18 +---- crates/federate/src/federation_queue_state.rs | 6 +- crates/federate/src/worker.rs | 8 +- crates/routes/src/feeds.rs | 15 +--- crates/routes/src/images.rs | 5 +- crates/utils/src/email.rs | 4 +- crates/utils/src/response.rs | 13 +--- .../utils/src/utils/markdown/spoiler_rule.rs | 5 +- crates/utils/src/utils/validation.rs | 18 +---- docker/docker-compose.yml | 8 +- docker/federation/docker-compose.yml | 8 +- src/api_routes_http.rs | 78 +++++-------------- src/code_migrations.rs | 18 +---- src/lib.rs | 16 ++-- src/scheduled_tasks.rs | 13 +--- 155 files changed, 339 insertions(+), 1140 deletions(-) diff --git a/crates/api/src/community/ban.rs b/crates/api/src/community/ban.rs index c2f70b7c0..76b116193 100644 --- a/crates/api/src/community/ban.rs +++ b/crates/api/src/community/ban.rs @@ -9,10 +9,7 @@ use lemmy_api_common::{ use lemmy_db_schema::{ source::{ community::{ - CommunityFollower, - CommunityFollowerForm, - CommunityPersonBan, - CommunityPersonBanForm, + CommunityFollower, CommunityFollowerForm, CommunityPersonBan, CommunityPersonBanForm, }, moderator::{ModBanFromCommunity, ModBanFromCommunityForm}, }, diff --git a/crates/api/src/local_user/change_password_after_reset.rs b/crates/api/src/local_user/change_password_after_reset.rs index 1bb501dd6..8558bd194 100644 --- a/crates/api/src/local_user/change_password_after_reset.rs +++ b/crates/api/src/local_user/change_password_after_reset.rs @@ -5,8 +5,7 @@ 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}; diff --git a/crates/api/src/local_user/generate_totp_secret.rs b/crates/api/src/local_user/generate_totp_secret.rs index a983beaaa..0a575a72d 100644 --- a/crates/api/src/local_user/generate_totp_secret.rs +++ b/crates/api/src/local_user/generate_totp_secret.rs @@ -2,9 +2,7 @@ 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}, diff --git a/crates/api/src/local_user/notifications/mark_all_read.rs b/crates/api/src/local_user/notifications/mark_all_read.rs index d3667460b..7bd38800a 100644 --- a/crates/api/src/local_user/notifications/mark_all_read.rs +++ b/crates/api/src/local_user/notifications/mark_all_read.rs @@ -1,9 +1,7 @@ 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}; diff --git a/crates/api/src/local_user/report_count.rs b/crates/api/src/local_user/report_count.rs index 3bfa1559b..372febab4 100644 --- a/crates/api/src/local_user/report_count.rs +++ b/crates/api/src/local_user/report_count.rs @@ -4,10 +4,7 @@ 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; diff --git a/crates/api/src/post/like.rs b/crates/api/src/post/like.rs index d4f9d644d..552648952 100644 --- a/crates/api/src/post/like.rs +++ b/crates/api/src/post/like.rs @@ -6,9 +6,7 @@ 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, }, }; diff --git a/crates/api/src/private_message_report/list.rs b/crates/api/src/private_message_report/list.rs index 2dc3e6efc..e2c83f7be 100644 --- a/crates/api/src/private_message_report/list.rs +++ b/crates/api/src/private_message_report/list.rs @@ -5,8 +5,7 @@ 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; diff --git a/crates/api/src/site/federated_instances.rs b/crates/api/src/site/federated_instances.rs index 8f224b2eb..370b9051f 100644 --- a/crates/api/src/site/federated_instances.rs +++ b/crates/api/src/site/federated_instances.rs @@ -1,8 +1,6 @@ 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; diff --git a/crates/api/src/site/mod_log.rs b/crates/api/src/site/mod_log.rs index 9c66c72a1..a7368d013 100644 --- a/crates/api/src/site/mod_log.rs +++ b/crates/api/src/site/mod_log.rs @@ -11,22 +11,10 @@ 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::*; diff --git a/crates/api/src/site/registration_applications/list.rs b/crates/api/src/site/registration_applications/list.rs index 30ce9aaf2..d23753b24 100644 --- a/crates/api/src/site/registration_applications/list.rs +++ b/crates/api/src/site/registration_applications/list.rs @@ -6,8 +6,7 @@ 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; diff --git a/crates/api/src/site/registration_applications/unread_count.rs b/crates/api/src/site/registration_applications/unread_count.rs index 255859198..6fad42237 100644 --- a/crates/api/src/site/registration_applications/unread_count.rs +++ b/crates/api/src/site/registration_applications/unread_count.rs @@ -1,8 +1,6 @@ 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}; diff --git a/crates/api_common/src/comment.rs b/crates/api_common/src/comment.rs index c2589fb2a..0f059d04c 100644 --- a/crates/api_common/src/comment.rs +++ b/crates/api_common/src/comment.rs @@ -1,7 +1,6 @@ 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}; diff --git a/crates/api_common/src/community.rs b/crates/api_common/src/community.rs index 7c96344b5..e4aa206d2 100644 --- a/crates/api_common/src/community.rs +++ b/crates/api_common/src/community.rs @@ -1,8 +1,7 @@ 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}; diff --git a/crates/api_common/src/person.rs b/crates/api_common/src/person.rs index feb945b17..bcf59a695 100644 --- a/crates/api_common/src/person.rs +++ b/crates/api_common/src/person.rs @@ -1,16 +1,11 @@ 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; diff --git a/crates/api_common/src/post.rs b/crates/api_common/src/post.rs index 86f721701..6ac82d07e 100644 --- a/crates/api_common/src/post.rs +++ b/crates/api_common/src/post.rs @@ -1,8 +1,6 @@ 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}; diff --git a/crates/api_common/src/request.rs b/crates/api_common/src/request.rs index b27bf2e92..116f30e43 100644 --- a/crates/api_common/src/request.rs +++ b/crates/api_common/src/request.rs @@ -302,10 +302,7 @@ 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; diff --git a/crates/api_common/src/send_activity.rs b/crates/api_common/src/send_activity.rs index 6d9c722a1..33a4a7573 100644 --- a/crates/api_common/src/send_activity.rs +++ b/crates/api_common/src/send_activity.rs @@ -9,10 +9,7 @@ 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, }, }; diff --git a/crates/api_common/src/site.rs b/crates/api_common/src/site.rs index b047c6dd0..f01853275 100644 --- a/crates/api_common/src/site.rs +++ b/crates/api_common/src/site.rs @@ -1,45 +1,20 @@ 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; diff --git a/crates/api_common/src/utils.rs b/crates/api_common/src/utils.rs index 26ef18c9e..370ae1316 100644 --- a/crates/api_common/src/utils.rs +++ b/crates/api_common/src/utils.rs @@ -21,9 +21,7 @@ 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}, diff --git a/crates/api_crud/src/comment/create.rs b/crates/api_crud/src/comment/create.rs index c9aa4f774..bca43fc5c 100644 --- a/crates/api_crud/src/comment/create.rs +++ b/crates/api_crud/src/comment/create.rs @@ -6,13 +6,8 @@ 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, }, }; @@ -31,9 +26,7 @@ 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, }, }; diff --git a/crates/api_crud/src/comment/update.rs b/crates/api_crud/src/comment/update.rs index 2d966d0fa..dd743bef2 100644 --- a/crates/api_crud/src/comment/update.rs +++ b/crates/api_crud/src/comment/update.rs @@ -20,9 +20,7 @@ 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, }, }; diff --git a/crates/api_crud/src/community/create.rs b/crates/api_crud/src/community/create.rs index 633fa81a9..1735d9bcf 100644 --- a/crates/api_crud/src/community/create.rs +++ b/crates/api_crud/src/community/create.rs @@ -5,26 +5,16 @@ 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, }, }, diff --git a/crates/api_crud/src/post/create.rs b/crates/api_crud/src/post/create.rs index 4fb97c1c7..efd357714 100644 --- a/crates/api_crud/src/post/create.rs +++ b/crates/api_crud/src/post/create.rs @@ -7,15 +7,9 @@ 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::{ diff --git a/crates/api_crud/src/private_message/create.rs b/crates/api_crud/src/private_message/create.rs index c0bdb8ed1..e45a9fd33 100644 --- a/crates/api_crud/src/private_message/create.rs +++ b/crates/api_crud/src/private_message/create.rs @@ -5,13 +5,8 @@ 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::{ diff --git a/crates/api_crud/src/site/create.rs b/crates/api_crud/src/site/create.rs index 136a187f2..a06a04850 100644 --- a/crates/api_crud/src/site/create.rs +++ b/crates/api_crud/src/site/create.rs @@ -5,11 +5,8 @@ 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::{ @@ -29,11 +26,8 @@ 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, }, }, }; diff --git a/crates/api_crud/src/site/read.rs b/crates/api_crud/src/site/read.rs index 2f16b8696..d1f7b49c7 100644 --- a/crates/api_crud/src/site/read.rs +++ b/crates/api_crud/src/site/read.rs @@ -10,12 +10,8 @@ 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}, diff --git a/crates/api_crud/src/site/update.rs b/crates/api_crud/src/site/update.rs index 792faa785..894c2c054 100644 --- a/crates/api_crud/src/site/update.rs +++ b/crates/api_crud/src/site/update.rs @@ -26,11 +26,8 @@ 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, }, }, }; diff --git a/crates/api_crud/src/user/create.rs b/crates/api_crud/src/user/create.rs index e1efcbed2..899fc7ce0 100644 --- a/crates/api_crud/src/user/create.rs +++ b/crates/api_crud/src/user/create.rs @@ -4,17 +4,9 @@ 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::{ diff --git a/crates/apub/src/activities/block/block_user.rs b/crates/apub/src/activities/block/block_user.rs index a4fd7c9b8..028e12713 100644 --- a/crates/apub/src/activities/block/block_user.rs +++ b/crates/apub/src/activities/block/block_user.rs @@ -2,10 +2,7 @@ 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, @@ -29,10 +26,7 @@ use lemmy_db_schema::{ source::{ activity::ActivitySendTargets, community::{ - CommunityFollower, - CommunityFollowerForm, - CommunityPersonBan, - CommunityPersonBanForm, + CommunityFollower, CommunityFollowerForm, CommunityPersonBan, CommunityPersonBanForm, }, moderator::{ModBan, ModBanForm, ModBanFromCommunity, ModBanFromCommunityForm}, person::{Person, PersonUpdateForm}, diff --git a/crates/apub/src/activities/block/undo_block_user.rs b/crates/apub/src/activities/block/undo_block_user.rs index 0796f86e7..5d6492ebf 100644 --- a/crates/apub/src/activities/block/undo_block_user.rs +++ b/crates/apub/src/activities/block/undo_block_user.rs @@ -2,9 +2,7 @@ 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, diff --git a/crates/apub/src/activities/community/announce.rs b/crates/apub/src/activities/community/announce.rs index e84a970f3..67df958e9 100644 --- a/crates/apub/src/activities/community/announce.rs +++ b/crates/apub/src/activities/community/announce.rs @@ -1,9 +1,6 @@ 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, @@ -11,9 +8,7 @@ use crate::{ objects::community::ApubCommunity, protocol::{ activities::community::announce::{AnnounceActivity, RawAnnouncableActivities}, - Id, - IdOrNestedObject, - InCommunity, + Id, IdOrNestedObject, InCommunity, }, }; use activitypub_federation::{ diff --git a/crates/apub/src/activities/community/collection_add.rs b/crates/apub/src/activities/community/collection_add.rs index 49e84f593..399be5ac8 100644 --- a/crates/apub/src/activities/community/collection_add.rs +++ b/crates/apub/src/activities/community/collection_add.rs @@ -1,10 +1,7 @@ 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, diff --git a/crates/apub/src/activities/community/collection_remove.rs b/crates/apub/src/activities/community/collection_remove.rs index 72d58c114..e58286ae5 100644 --- a/crates/apub/src/activities/community/collection_remove.rs +++ b/crates/apub/src/activities/community/collection_remove.rs @@ -1,10 +1,7 @@ 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, diff --git a/crates/apub/src/activities/community/lock_page.rs b/crates/apub/src/activities/community/lock_page.rs index b6caef9dc..f388520ad 100644 --- a/crates/apub/src/activities/community/lock_page.rs +++ b/crates/apub/src/activities/community/lock_page.rs @@ -1,11 +1,7 @@ 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, diff --git a/crates/apub/src/activities/community/update.rs b/crates/apub/src/activities/community/update.rs index 6a4fcbfdd..1ae803dc1 100644 --- a/crates/apub/src/activities/community/update.rs +++ b/crates/apub/src/activities/community/update.rs @@ -1,10 +1,7 @@ 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, diff --git a/crates/apub/src/activities/create_or_update/comment.rs b/crates/apub/src/activities/create_or_update/comment.rs index 502bc5e0c..2b12edc41 100644 --- a/crates/apub/src/activities/create_or_update/comment.rs +++ b/crates/apub/src/activities/create_or_update/comment.rs @@ -1,10 +1,7 @@ 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, diff --git a/crates/apub/src/activities/create_or_update/post.rs b/crates/apub/src/activities/create_or_update/post.rs index 018f84da4..8906997cf 100644 --- a/crates/apub/src/activities/create_or_update/post.rs +++ b/crates/apub/src/activities/create_or_update/post.rs @@ -1,11 +1,7 @@ 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, diff --git a/crates/apub/src/activities/create_or_update/private_message.rs b/crates/apub/src/activities/create_or_update/private_message.rs index 74f833051..a6ae25f83 100644 --- a/crates/apub/src/activities/create_or_update/private_message.rs +++ b/crates/apub/src/activities/create_or_update/private_message.rs @@ -3,8 +3,7 @@ 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::{ diff --git a/crates/apub/src/activities/deletion/delete.rs b/crates/apub/src/activities/deletion/delete.rs index 88bf2b523..21ed2e2e0 100644 --- a/crates/apub/src/activities/deletion/delete.rs +++ b/crates/apub/src/activities/deletion/delete.rs @@ -14,12 +14,8 @@ 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}, }, diff --git a/crates/apub/src/activities/deletion/mod.rs b/crates/apub/src/activities/deletion/mod.rs index 74112fb58..d77eebd4a 100644 --- a/crates/apub/src/activities/deletion/mod.rs +++ b/crates/apub/src/activities/deletion/mod.rs @@ -1,18 +1,11 @@ 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::{ diff --git a/crates/apub/src/activities/deletion/undo_delete.rs b/crates/apub/src/activities/deletion/undo_delete.rs index 6572938dd..60de17826 100644 --- a/crates/apub/src/activities/deletion/undo_delete.rs +++ b/crates/apub/src/activities/deletion/undo_delete.rs @@ -14,12 +14,8 @@ 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}, }, diff --git a/crates/apub/src/activities/following/follow.rs b/crates/apub/src/activities/following/follow.rs index 6f6e2718f..e0ccc088d 100644 --- a/crates/apub/src/activities/following/follow.rs +++ b/crates/apub/src/activities/following/follow.rs @@ -1,9 +1,6 @@ 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, diff --git a/crates/apub/src/activities/mod.rs b/crates/apub/src/activities/mod.rs index 958065ffa..b911f1814 100644 --- a/crates/apub/src/activities/mod.rs +++ b/crates/apub/src/activities/mod.rs @@ -9,11 +9,8 @@ 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, }, diff --git a/crates/apub/src/activities/voting/undo_vote.rs b/crates/apub/src/activities/voting/undo_vote.rs index 9616c651f..30b2b51dd 100644 --- a/crates/apub/src/activities/voting/undo_vote.rs +++ b/crates/apub/src/activities/voting/undo_vote.rs @@ -1,7 +1,6 @@ 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, diff --git a/crates/apub/src/activities/voting/vote.rs b/crates/apub/src/activities/voting/vote.rs index 926c29302..3953a9022 100644 --- a/crates/apub/src/activities/voting/vote.rs +++ b/crates/apub/src/activities/voting/vote.rs @@ -1,7 +1,6 @@ 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, diff --git a/crates/apub/src/activity_lists.rs b/crates/apub/src/activity_lists.rs index d4ca20c33..215a9ad00 100644 --- a/crates/apub/src/activity_lists.rs +++ b/crates/apub/src/activity_lists.rs @@ -12,9 +12,7 @@ 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}, diff --git a/crates/apub/src/api/list_comments.rs b/crates/apub/src/api/list_comments.rs index 7d1de019e..eaf9ac3fd 100644 --- a/crates/apub/src/api/list_comments.rs +++ b/crates/apub/src/api/list_comments.rs @@ -1,6 +1,5 @@ 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; diff --git a/crates/apub/src/api/list_posts.rs b/crates/apub/src/api/list_posts.rs index dc3618c50..ac04acee2 100644 --- a/crates/apub/src/api/list_posts.rs +++ b/crates/apub/src/api/list_posts.rs @@ -1,6 +1,5 @@ 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; diff --git a/crates/apub/src/api/read_community.rs b/crates/apub/src/api/read_community.rs index afa6fb829..490d8b52c 100644 --- a/crates/apub/src/api/read_community.rs +++ b/crates/apub/src/api/read_community.rs @@ -7,10 +7,7 @@ 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}; diff --git a/crates/apub/src/api/resolve_object.rs b/crates/apub/src/api/resolve_object.rs index e081377f6..b19e8d425 100644 --- a/crates/apub/src/api/resolve_object.rs +++ b/crates/apub/src/api/resolve_object.rs @@ -1,7 +1,5 @@ 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}; diff --git a/crates/apub/src/collections/community_moderators.rs b/crates/apub/src/collections/community_moderators.rs index cdaf985ea..57147b806 100644 --- a/crates/apub/src/collections/community_moderators.rs +++ b/crates/apub/src/collections/community_moderators.rs @@ -3,11 +3,8 @@ 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::{ @@ -108,8 +105,7 @@ 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, diff --git a/crates/apub/src/collections/community_outbox.rs b/crates/apub/src/collections/community_outbox.rs index 854db9349..3b6782d86 100644 --- a/crates/apub/src/collections/community_outbox.rs +++ b/crates/apub/src/collections/community_outbox.rs @@ -3,8 +3,7 @@ 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, diff --git a/crates/apub/src/http/community.rs b/crates/apub/src/http/community.rs index d004bac56..6bdacc7f2 100644 --- a/crates/apub/src/http/community.rs +++ b/crates/apub/src/http/community.rs @@ -1,8 +1,7 @@ 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}, diff --git a/crates/apub/src/http/mod.rs b/crates/apub/src/http/mod.rs index c261d9e49..bee4da097 100644 --- a/crates/apub/src/http/mod.rs +++ b/crates/apub/src/http/mod.rs @@ -1,13 +1,9 @@ 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}; diff --git a/crates/apub/src/http/person.rs b/crates/apub/src/http/person.rs index 254313634..0d2182093 100644 --- a/crates/apub/src/http/person.rs +++ b/crates/apub/src/http/person.rs @@ -6,10 +6,7 @@ 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}; diff --git a/crates/apub/src/http/routes.rs b/crates/apub/src/http/routes.rs index 0012fccf2..ba11bd59b 100644 --- a/crates/apub/src/http/routes.rs +++ b/crates/apub/src/http/routes.rs @@ -1,12 +1,8 @@ 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}, diff --git a/crates/apub/src/http/site.rs b/crates/apub/src/http/site.rs index 071f4aa6e..b135a73cc 100644 --- a/crates/apub/src/http/site.rs +++ b/crates/apub/src/http/site.rs @@ -5,10 +5,7 @@ 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; diff --git a/crates/apub/src/objects/comment.rs b/crates/apub/src/objects/comment.rs index 599dd7387..a32a7500e 100644 --- a/crates/apub/src/objects/comment.rs +++ b/crates/apub/src/objects/comment.rs @@ -5,8 +5,7 @@ use crate::{ objects::{read_from_string_or_source, verify_is_remote_object}, protocol::{ objects::{note::Note, LanguageTag}, - InCommunity, - Source, + InCommunity, Source, }, }; use activitypub_federation::{ diff --git a/crates/apub/src/objects/community.rs b/crates/apub/src/objects/community.rs index 3e8c62746..04bb56832 100644 --- a/crates/apub/src/objects/community.rs +++ b/crates/apub/src/objects/community.rs @@ -1,12 +1,10 @@ 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::{ diff --git a/crates/apub/src/objects/instance.rs b/crates/apub/src/objects/instance.rs index 5949e12bf..0785a700f 100644 --- a/crates/apub/src/objects/instance.rs +++ b/crates/apub/src/objects/instance.rs @@ -1,12 +1,10 @@ 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::{ diff --git a/crates/apub/src/objects/person.rs b/crates/apub/src/objects/person.rs index 34d824890..e7d9312d7 100644 --- a/crates/apub/src/objects/person.rs +++ b/crates/apub/src/objects/person.rs @@ -1,15 +1,13 @@ 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::{ @@ -21,9 +19,7 @@ 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, }, }; diff --git a/crates/apub/src/objects/post.rs b/crates/apub/src/objects/post.rs index 2fc859ddf..4a69b7344 100644 --- a/crates/apub/src/objects/post.rs +++ b/crates/apub/src/objects/post.rs @@ -1,16 +1,13 @@ 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::{ @@ -26,11 +23,8 @@ 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::{ @@ -300,9 +294,7 @@ 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, diff --git a/crates/apub/src/protocol/activities/block/block_user.rs b/crates/apub/src/protocol/activities/block/block_user.rs index b958b58e1..8f8be15e1 100644 --- a/crates/apub/src/protocol/activities/block/block_user.rs +++ b/crates/apub/src/protocol/activities/block/block_user.rs @@ -4,9 +4,7 @@ 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; diff --git a/crates/apub/src/protocol/activities/block/undo_block_user.rs b/crates/apub/src/protocol/activities/block/undo_block_user.rs index 758d3fd4b..b3b77998e 100644 --- a/crates/apub/src/protocol/activities/block/undo_block_user.rs +++ b/crates/apub/src/protocol/activities/block/undo_block_user.rs @@ -4,9 +4,7 @@ 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; diff --git a/crates/apub/src/protocol/activities/community/announce.rs b/crates/apub/src/protocol/activities/community/announce.rs index e149e5fd1..f4d960fa9 100644 --- a/crates/apub/src/protocol/activities/community/announce.rs +++ b/crates/apub/src/protocol/activities/community/announce.rs @@ -1,7 +1,6 @@ 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}; diff --git a/crates/apub/src/protocol/activities/community/collection_add.rs b/crates/apub/src/protocol/activities/community/collection_add.rs index edf67740a..8e5748b45 100644 --- a/crates/apub/src/protocol/activities/community/collection_add.rs +++ b/crates/apub/src/protocol/activities/community/collection_add.rs @@ -4,9 +4,7 @@ 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; diff --git a/crates/apub/src/protocol/activities/community/collection_remove.rs b/crates/apub/src/protocol/activities/community/collection_remove.rs index 960951732..3bb0c7a7b 100644 --- a/crates/apub/src/protocol/activities/community/collection_remove.rs +++ b/crates/apub/src/protocol/activities/community/collection_remove.rs @@ -4,9 +4,7 @@ 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; diff --git a/crates/apub/src/protocol/activities/community/lock_page.rs b/crates/apub/src/protocol/activities/community/lock_page.rs index 33b108531..b662f6740 100644 --- a/crates/apub/src/protocol/activities/community/lock_page.rs +++ b/crates/apub/src/protocol/activities/community/lock_page.rs @@ -4,9 +4,7 @@ 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; diff --git a/crates/apub/src/protocol/activities/community/report.rs b/crates/apub/src/protocol/activities/community/report.rs index 6e8a1bbf3..698d88f17 100644 --- a/crates/apub/src/protocol/activities/community/report.rs +++ b/crates/apub/src/protocol/activities/community/report.rs @@ -5,9 +5,7 @@ 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; diff --git a/crates/apub/src/protocol/activities/community/update.rs b/crates/apub/src/protocol/activities/community/update.rs index 49ec1f5d6..8be7bdfeb 100644 --- a/crates/apub/src/protocol/activities/community/update.rs +++ b/crates/apub/src/protocol/activities/community/update.rs @@ -4,9 +4,7 @@ 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; diff --git a/crates/apub/src/protocol/activities/create_or_update/mod.rs b/crates/apub/src/protocol/activities/create_or_update/mod.rs index a516bf9b4..2e77ac440 100644 --- a/crates/apub/src/protocol/activities/create_or_update/mod.rs +++ b/crates/apub/src/protocol/activities/create_or_update/mod.rs @@ -9,9 +9,7 @@ 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, }; diff --git a/crates/apub/src/protocol/activities/create_or_update/note.rs b/crates/apub/src/protocol/activities/create_or_update/note.rs index 6fabc0aaa..742140908 100644 --- a/crates/apub/src/protocol/activities/create_or_update/note.rs +++ b/crates/apub/src/protocol/activities/create_or_update/note.rs @@ -5,9 +5,7 @@ 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}; diff --git a/crates/apub/src/protocol/activities/create_or_update/page.rs b/crates/apub/src/protocol/activities/create_or_update/page.rs index ec64c31a0..7e62be1f2 100644 --- a/crates/apub/src/protocol/activities/create_or_update/page.rs +++ b/crates/apub/src/protocol/activities/create_or_update/page.rs @@ -4,9 +4,7 @@ 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; diff --git a/crates/apub/src/protocol/activities/deletion/delete.rs b/crates/apub/src/protocol/activities/deletion/delete.rs index 2a7bfeebe..0061822b4 100644 --- a/crates/apub/src/protocol/activities/deletion/delete.rs +++ b/crates/apub/src/protocol/activities/deletion/delete.rs @@ -4,9 +4,7 @@ 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; diff --git a/crates/apub/src/protocol/activities/deletion/delete_user.rs b/crates/apub/src/protocol/activities/deletion/delete_user.rs index 46b070fab..c7a9178e3 100644 --- a/crates/apub/src/protocol/activities/deletion/delete_user.rs +++ b/crates/apub/src/protocol/activities/deletion/delete_user.rs @@ -1,7 +1,6 @@ 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}; diff --git a/crates/apub/src/protocol/activities/deletion/undo_delete.rs b/crates/apub/src/protocol/activities/deletion/undo_delete.rs index 35d9951b1..5e74309fa 100644 --- a/crates/apub/src/protocol/activities/deletion/undo_delete.rs +++ b/crates/apub/src/protocol/activities/deletion/undo_delete.rs @@ -4,9 +4,7 @@ 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; diff --git a/crates/apub/src/protocol/activities/following/accept.rs b/crates/apub/src/protocol/activities/following/accept.rs index 181ea7188..63403efc3 100644 --- a/crates/apub/src/protocol/activities/following/accept.rs +++ b/crates/apub/src/protocol/activities/following/accept.rs @@ -3,8 +3,7 @@ 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}; diff --git a/crates/apub/src/protocol/activities/following/follow.rs b/crates/apub/src/protocol/activities/following/follow.rs index 5d5104ea6..7cd051f24 100644 --- a/crates/apub/src/protocol/activities/following/follow.rs +++ b/crates/apub/src/protocol/activities/following/follow.rs @@ -1,7 +1,6 @@ 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}; diff --git a/crates/apub/src/protocol/activities/following/undo_follow.rs b/crates/apub/src/protocol/activities/following/undo_follow.rs index aa582e99a..218672301 100644 --- a/crates/apub/src/protocol/activities/following/undo_follow.rs +++ b/crates/apub/src/protocol/activities/following/undo_follow.rs @@ -1,8 +1,6 @@ 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; diff --git a/crates/apub/src/protocol/collections/group_moderators.rs b/crates/apub/src/protocol/collections/group_moderators.rs index 3e41e1247..108f84ffc 100644 --- a/crates/apub/src/protocol/collections/group_moderators.rs +++ b/crates/apub/src/protocol/collections/group_moderators.rs @@ -1,7 +1,6 @@ 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; diff --git a/crates/apub/src/protocol/collections/mod.rs b/crates/apub/src/protocol/collections/mod.rs index 2362a998a..ead1b68f5 100644 --- a/crates/apub/src/protocol/collections/mod.rs +++ b/crates/apub/src/protocol/collections/mod.rs @@ -11,11 +11,8 @@ 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}, }; diff --git a/crates/apub/src/protocol/mod.rs b/crates/apub/src/protocol/mod.rs index dba21f99d..1127771dc 100644 --- a/crates/apub/src/protocol/mod.rs +++ b/crates/apub/src/protocol/mod.rs @@ -1,8 +1,6 @@ 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; diff --git a/crates/apub/src/protocol/objects/group.rs b/crates/apub/src/protocol/objects/group.rs index 9d0229785..41a0d8da8 100644 --- a/crates/apub/src/protocol/objects/group.rs +++ b/crates/apub/src/protocol/objects/group.rs @@ -1,25 +1,21 @@ 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}; diff --git a/crates/apub/src/protocol/objects/mod.rs b/crates/apub/src/protocol/objects/mod.rs index 9a3dab185..1cf8248b8 100644 --- a/crates/apub/src/protocol/objects/mod.rs +++ b/crates/apub/src/protocol/objects/mod.rs @@ -1,7 +1,5 @@ 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; @@ -100,13 +98,8 @@ 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}, }; diff --git a/crates/db_schema/src/aggregates/post_aggregates.rs b/crates/db_schema/src/aggregates/post_aggregates.rs index 1816ee5f3..b733f6de9 100644 --- a/crates/db_schema/src/aggregates/post_aggregates.rs +++ b/crates/db_schema/src/aggregates/post_aggregates.rs @@ -4,8 +4,7 @@ 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}; diff --git a/crates/db_schema/src/aggregates/structs.rs b/crates/db_schema/src/aggregates/structs.rs index 03ff9a640..eb8a438df 100644 --- a/crates/db_schema/src/aggregates/structs.rs +++ b/crates/db_schema/src/aggregates/structs.rs @@ -1,12 +1,8 @@ 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}; diff --git a/crates/db_schema/src/impls/activity.rs b/crates/db_schema/src/impls/activity.rs index 16b0fca40..d11a604a9 100644 --- a/crates/db_schema/src/impls/activity.rs +++ b/crates/db_schema/src/impls/activity.rs @@ -7,8 +7,7 @@ use crate::{ use diesel::{ dsl::insert_into, result::{DatabaseErrorKind, Error, Error::DatabaseError}, - ExpressionMethods, - QueryDsl, + ExpressionMethods, QueryDsl, }; use diesel_async::RunQueryDsl; diff --git a/crates/db_schema/src/impls/actor_language.rs b/crates/db_schema/src/impls/actor_language.rs index 313762a72..7b22690ec 100644 --- a/crates/db_schema/src/impls/actor_language.rs +++ b/crates/db_schema/src/impls/actor_language.rs @@ -4,12 +4,8 @@ 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, @@ -21,9 +17,7 @@ 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}; @@ -37,9 +31,7 @@ impl LocalUserLanguage { for_local_user_id: LocalUserId, ) -> Result, 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?; @@ -222,9 +214,7 @@ 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 = cl::community_language .left_outer_join(sl::site_language.on(cl::language_id.eq(sl::language_id))) @@ -390,17 +380,8 @@ 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::{ diff --git a/crates/db_schema/src/impls/captcha_answer.rs b/crates/db_schema/src/impls/captcha_answer.rs index 0404ce005..a98a6ba57 100644 --- a/crates/db_schema/src/impls/captcha_answer.rs +++ b/crates/db_schema/src/impls/captcha_answer.rs @@ -4,13 +4,7 @@ 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; diff --git a/crates/db_schema/src/impls/comment.rs b/crates/db_schema/src/impls/comment.rs index cab033df3..8a18bf28e 100644 --- a/crates/db_schema/src/impls/comment.rs +++ b/crates/db_schema/src/impls/comment.rs @@ -2,12 +2,7 @@ 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}, @@ -16,8 +11,7 @@ use crate::{ use diesel::{ dsl::{insert_into, sql_query}, result::Error, - ExpressionMethods, - QueryDsl, + ExpressionMethods, QueryDsl, }; use diesel_async::RunQueryDsl; use diesel_ltree::Ltree; @@ -249,12 +243,7 @@ mod tests { newtypes::LanguageId, source::{ comment::{ - Comment, - CommentInsertForm, - CommentLike, - CommentLikeForm, - CommentSaved, - CommentSavedForm, + Comment, CommentInsertForm, CommentLike, CommentLikeForm, CommentSaved, CommentSavedForm, CommentUpdateForm, }, community::{Community, CommunityInsertForm}, diff --git a/crates/db_schema/src/impls/comment_report.rs b/crates/db_schema/src/impls/comment_report.rs index ff93915e1..cf2019a06 100644 --- a/crates/db_schema/src/impls/comment_report.rs +++ b/crates/db_schema/src/impls/comment_report.rs @@ -8,8 +8,7 @@ use crate::{ use diesel::{ dsl::{insert_into, update}, result::Error, - ExpressionMethods, - QueryDsl, + ExpressionMethods, QueryDsl, }; use diesel_async::RunQueryDsl; diff --git a/crates/db_schema/src/impls/community.rs b/crates/db_schema/src/impls/community.rs index 82d2847f4..d24af3580 100644 --- a/crates/db_schema/src/impls/community.rs +++ b/crates/db_schema/src/impls/community.rs @@ -4,15 +4,8 @@ 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}, @@ -20,16 +13,8 @@ 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; @@ -262,10 +247,7 @@ impl Followable for CommunityFollower { person_id_: PersonId, ) -> Result { 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( @@ -349,14 +331,8 @@ 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, diff --git a/crates/db_schema/src/impls/email_verification.rs b/crates/db_schema/src/impls/email_verification.rs index c5a8792fb..2fa69f847 100644 --- a/crates/db_schema/src/impls/email_verification.rs +++ b/crates/db_schema/src/impls/email_verification.rs @@ -1,10 +1,7 @@ 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}, @@ -14,9 +11,7 @@ use diesel::{ insert_into, result::Error, sql_types::Timestamptz, - ExpressionMethods, - IntoSql, - QueryDsl, + ExpressionMethods, IntoSql, QueryDsl, }; use diesel_async::RunQueryDsl; diff --git a/crates/db_schema/src/impls/instance.rs b/crates/db_schema/src/impls/instance.rs index 7e162717c..ca2462666 100644 --- a/crates/db_schema/src/impls/instance.rs +++ b/crates/db_schema/src/impls/instance.rs @@ -9,10 +9,7 @@ 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; diff --git a/crates/db_schema/src/impls/local_site_rate_limit.rs b/crates/db_schema/src/impls/local_site_rate_limit.rs index 0c9e96e0b..1cd2af037 100644 --- a/crates/db_schema/src/impls/local_site_rate_limit.rs +++ b/crates/db_schema/src/impls/local_site_rate_limit.rs @@ -1,9 +1,7 @@ use crate::{ schema::local_site_rate_limit, source::local_site_rate_limit::{ - LocalSiteRateLimit, - LocalSiteRateLimitInsertForm, - LocalSiteRateLimitUpdateForm, + LocalSiteRateLimit, LocalSiteRateLimitInsertForm, LocalSiteRateLimitUpdateForm, }, utils::{get_conn, DbPool}, }; diff --git a/crates/db_schema/src/impls/local_user.rs b/crates/db_schema/src/impls/local_user.rs index 6ef3421d3..54ef927b8 100644 --- a/crates/db_schema/src/impls/local_user.rs +++ b/crates/db_schema/src/impls/local_user.rs @@ -1,12 +1,7 @@ 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}, diff --git a/crates/db_schema/src/impls/moderator.rs b/crates/db_schema/src/impls/moderator.rs index a4c300b2a..4939e0454 100644 --- a/crates/db_schema/src/impls/moderator.rs +++ b/crates/db_schema/src/impls/moderator.rs @@ -1,35 +1,12 @@ 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}, @@ -475,24 +452,10 @@ 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}, diff --git a/crates/db_schema/src/impls/password_reset_request.rs b/crates/db_schema/src/impls/password_reset_request.rs index 5600ffc66..8c7b29874 100644 --- a/crates/db_schema/src/impls/password_reset_request.rs +++ b/crates/db_schema/src/impls/password_reset_request.rs @@ -9,9 +9,7 @@ use diesel::{ dsl::{insert_into, now, IntervalDsl}, result::Error, sql_types::Timestamptz, - ExpressionMethods, - IntoSql, - QueryDsl, + ExpressionMethods, IntoSql, QueryDsl, }; use diesel_async::RunQueryDsl; diff --git a/crates/db_schema/src/impls/person.rs b/crates/db_schema/src/impls/person.rs index 723062aeb..739c72eed 100644 --- a/crates/db_schema/src/impls/person.rs +++ b/crates/db_schema/src/impls/person.rs @@ -2,11 +2,7 @@ use crate::{ newtypes::{CommunityId, DbUrl, PersonId}, schema::{instance, local_user, person, person_follower}, source::person::{ - Person, - PersonFollower, - PersonFollowerForm, - PersonInsertForm, - PersonUpdateForm, + Person, PersonFollower, PersonFollowerForm, PersonInsertForm, PersonUpdateForm, }, traits::{ApubActor, Crud, Followable}, utils::{functions::lower, get_conn, naive_now, DbPool}, diff --git a/crates/db_schema/src/impls/post.rs b/crates/db_schema/src/impls/post.rs index 514aceaba..49f3dc5d9 100644 --- a/crates/db_schema/src/impls/post.rs +++ b/crates/db_schema/src/impls/post.rs @@ -2,30 +2,11 @@ use super::instance::coalesce; use crate::{ newtypes::{CommunityId, DbUrl, PersonId, PostId}, schema::post::dsl::{ - ap_id, - body, - community_id, - creator_id, - deleted, - featured_community, - local, - name, - post, - published, - removed, - thumbnail_url, - updated, - url, + ap_id, body, community_id, creator_id, deleted, featured_community, local, name, post, + published, removed, thumbnail_url, updated, url, }, source::post::{ - Post, - PostInsertForm, - PostLike, - PostLikeForm, - PostRead, - PostReadForm, - PostSaved, - PostSavedForm, + Post, PostInsertForm, PostLike, PostLikeForm, PostRead, PostReadForm, PostSaved, PostSavedForm, PostUpdateForm, }, traits::{Crud, Likeable, Readable, Saveable}, @@ -347,15 +328,8 @@ mod tests { instance::Instance, person::{Person, PersonInsertForm}, post::{ - Post, - PostInsertForm, - PostLike, - PostLikeForm, - PostRead, - PostReadForm, - PostSaved, - PostSavedForm, - PostUpdateForm, + Post, PostInsertForm, PostLike, PostLikeForm, PostRead, PostReadForm, PostSaved, + PostSavedForm, PostUpdateForm, }, }, traits::{Crud, Likeable, Readable, Saveable}, diff --git a/crates/db_schema/src/impls/post_report.rs b/crates/db_schema/src/impls/post_report.rs index b4078d950..bbde337d7 100644 --- a/crates/db_schema/src/impls/post_report.rs +++ b/crates/db_schema/src/impls/post_report.rs @@ -8,8 +8,7 @@ use crate::{ use diesel::{ dsl::{insert_into, update}, result::Error, - ExpressionMethods, - QueryDsl, + ExpressionMethods, QueryDsl, }; use diesel_async::RunQueryDsl; diff --git a/crates/db_schema/src/impls/private_message_report.rs b/crates/db_schema/src/impls/private_message_report.rs index ca2187960..cbc5da248 100644 --- a/crates/db_schema/src/impls/private_message_report.rs +++ b/crates/db_schema/src/impls/private_message_report.rs @@ -8,8 +8,7 @@ use crate::{ use diesel::{ dsl::{insert_into, update}, result::Error, - ExpressionMethods, - QueryDsl, + ExpressionMethods, QueryDsl, }; use diesel_async::RunQueryDsl; diff --git a/crates/db_schema/src/impls/registration_application.rs b/crates/db_schema/src/impls/registration_application.rs index c4df7ba69..e37375979 100644 --- a/crates/db_schema/src/impls/registration_application.rs +++ b/crates/db_schema/src/impls/registration_application.rs @@ -2,9 +2,7 @@ use crate::{ newtypes::LocalUserId, schema::registration_application::dsl::{local_user_id, registration_application}, source::registration_application::{ - RegistrationApplication, - RegistrationApplicationInsertForm, - RegistrationApplicationUpdateForm, + RegistrationApplication, RegistrationApplicationInsertForm, RegistrationApplicationUpdateForm, }, traits::Crud, utils::{get_conn, DbPool}, diff --git a/crates/db_schema/src/newtypes.rs b/crates/db_schema/src/newtypes.rs index 555b98256..afbb222c4 100644 --- a/crates/db_schema/src/newtypes.rs +++ b/crates/db_schema/src/newtypes.rs @@ -1,8 +1,6 @@ #[cfg(feature = "full")] use activitypub_federation::{ - fetch::collection_id::CollectionId, - fetch::object_id::ObjectId, - traits::Collection, + fetch::collection_id::CollectionId, fetch::object_id::ObjectId, traits::Collection, traits::Object, }; #[cfg(feature = "full")] diff --git a/crates/db_schema/src/source/actor_language.rs b/crates/db_schema/src/source/actor_language.rs index 6780be51b..f096d9ee9 100644 --- a/crates/db_schema/src/source/actor_language.rs +++ b/crates/db_schema/src/source/actor_language.rs @@ -1,10 +1,5 @@ use crate::newtypes::{ - CommunityId, - CommunityLanguageId, - LanguageId, - LocalUserId, - LocalUserLanguageId, - SiteId, + CommunityId, CommunityLanguageId, LanguageId, LocalUserId, LocalUserLanguageId, SiteId, SiteLanguageId, }; #[cfg(feature = "full")] diff --git a/crates/db_schema/src/source/local_site.rs b/crates/db_schema/src/source/local_site.rs index e5945e86f..0dfafc422 100644 --- a/crates/db_schema/src/source/local_site.rs +++ b/crates/db_schema/src/source/local_site.rs @@ -2,8 +2,7 @@ use crate::schema::local_site; use crate::{ newtypes::{LocalSiteId, SiteId}, - ListingType, - RegistrationMode, + ListingType, RegistrationMode, }; use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; diff --git a/crates/db_schema/src/source/local_user.rs b/crates/db_schema/src/source/local_user.rs index 98e01bd1a..78bc6d912 100644 --- a/crates/db_schema/src/source/local_user.rs +++ b/crates/db_schema/src/source/local_user.rs @@ -2,9 +2,7 @@ use crate::schema::local_user; use crate::{ newtypes::{LocalUserId, PersonId}, - ListingType, - PostListingMode, - SortType, + ListingType, PostListingMode, SortType, }; use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; diff --git a/crates/db_schema/src/source/moderator.rs b/crates/db_schema/src/source/moderator.rs index 7e2ff2867..d5370df67 100644 --- a/crates/db_schema/src/source/moderator.rs +++ b/crates/db_schema/src/source/moderator.rs @@ -1,21 +1,9 @@ use crate::newtypes::{CommentId, CommunityId, PersonId, PostId}; #[cfg(feature = "full")] use crate::schema::{ - admin_purge_comment, - admin_purge_community, - admin_purge_person, - admin_purge_post, - mod_add, - mod_add_community, - mod_ban, - mod_ban_from_community, - mod_feature_post, - mod_hide_community, - mod_lock_post, - mod_remove_comment, - mod_remove_community, - mod_remove_post, - mod_transfer_community, + admin_purge_comment, admin_purge_community, admin_purge_person, admin_purge_post, mod_add, + mod_add_community, mod_ban, mod_ban_from_community, mod_feature_post, mod_hide_community, + mod_lock_post, mod_remove_comment, mod_remove_community, mod_remove_post, mod_transfer_community, }; use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; diff --git a/crates/db_schema/src/traits.rs b/crates/db_schema/src/traits.rs index 9fa5a598c..230a2466b 100644 --- a/crates/db_schema/src/traits.rs +++ b/crates/db_schema/src/traits.rs @@ -12,8 +12,7 @@ use diesel::{ }; use diesel_async::{ methods::{ExecuteDsl, LoadQuery}, - AsyncPgConnection, - RunQueryDsl, + AsyncPgConnection, RunQueryDsl, }; /// Returned by `diesel::delete` diff --git a/crates/db_schema/src/utils.rs b/crates/db_schema/src/utils.rs index 7593cfd41..316d24796 100644 --- a/crates/db_schema/src/utils.rs +++ b/crates/db_schema/src/utils.rs @@ -1,10 +1,6 @@ use crate::{ - diesel::Connection, - diesel_migrations::MigrationHarness, - newtypes::DbUrl, - CommentSortType, - PersonSortType, - SortType, + diesel::Connection, diesel_migrations::MigrationHarness, newtypes::DbUrl, CommentSortType, + PersonSortType, SortType, }; use activitypub_federation::{fetch::object_id::ObjectId, traits::Object}; use chrono::{DateTime, Utc}; @@ -17,8 +13,7 @@ use diesel::{ result::{ConnectionError, ConnectionResult, Error as DieselError, Error::QueryBuilderError}, serialize::{Output, ToSql}, sql_types::{Text, Timestamptz}, - IntoSql, - PgConnection, + IntoSql, PgConnection, }; use diesel_async::{ pg::AsyncPgConnection, diff --git a/crates/db_views/src/comment_report_view.rs b/crates/db_views/src/comment_report_view.rs index cded46ac9..d381a467c 100644 --- a/crates/db_views/src/comment_report_view.rs +++ b/crates/db_views/src/comment_report_view.rs @@ -1,28 +1,15 @@ use crate::structs::{CommentReportView, LocalUserView}; use diesel::{ - dsl::now, - pg::Pg, - result::Error, - BoolExpressionMethods, - ExpressionMethods, - JoinOnDsl, - NullableExpressionMethods, - QueryDsl, + dsl::now, pg::Pg, result::Error, BoolExpressionMethods, ExpressionMethods, JoinOnDsl, + NullableExpressionMethods, QueryDsl, }; use diesel_async::RunQueryDsl; use lemmy_db_schema::{ aliases, newtypes::{CommentReportId, CommunityId, PersonId}, schema::{ - comment, - comment_aggregates, - comment_like, - comment_report, - community, - community_moderator, - community_person_ban, - person, - post, + comment, comment_aggregates, comment_like, comment_report, community, community_moderator, + community_person_ban, person, post, }, utils::{get_conn, limit_and_offset, DbConn, DbPool, ListFn, Queries, ReadFn}, }; diff --git a/crates/db_views/src/comment_view.rs b/crates/db_views/src/comment_view.rs index a3f35b0a9..9b180989a 100644 --- a/crates/db_views/src/comment_view.rs +++ b/crates/db_views/src/comment_view.rs @@ -1,38 +1,20 @@ use crate::structs::{CommentView, LocalUserView}; use diesel::{ - pg::Pg, - result::Error, - BoolExpressionMethods, - ExpressionMethods, - JoinOnDsl, - NullableExpressionMethods, - PgTextExpressionMethods, - QueryDsl, + pg::Pg, result::Error, BoolExpressionMethods, ExpressionMethods, JoinOnDsl, + NullableExpressionMethods, PgTextExpressionMethods, QueryDsl, }; use diesel_async::RunQueryDsl; use diesel_ltree::{nlevel, subpath, Ltree, LtreeExtensions}; use lemmy_db_schema::{ newtypes::{CommentId, CommunityId, LocalUserId, PersonId, PostId}, schema::{ - comment, - comment_aggregates, - comment_like, - comment_saved, - community, - community_block, - community_follower, - community_moderator, - community_person_ban, - instance_block, - local_user_language, - person, - person_block, - post, + comment, comment_aggregates, comment_like, comment_saved, community, community_block, + community_follower, community_moderator, community_person_ban, instance_block, + local_user_language, person, person_block, post, }, source::community::CommunityFollower, utils::{fuzzy_search, limit_and_offset, DbConn, DbPool, ListFn, Queries, ReadFn}, - CommentSortType, - ListingType, + CommentSortType, ListingType, }; fn queries<'a>() -> Queries< diff --git a/crates/db_views/src/post_report_view.rs b/crates/db_views/src/post_report_view.rs index 324023ecf..0233802a8 100644 --- a/crates/db_views/src/post_report_view.rs +++ b/crates/db_views/src/post_report_view.rs @@ -1,25 +1,14 @@ use crate::structs::{LocalUserView, PostReportView}; use diesel::{ - pg::Pg, - result::Error, - BoolExpressionMethods, - ExpressionMethods, - JoinOnDsl, - NullableExpressionMethods, - QueryDsl, + pg::Pg, result::Error, BoolExpressionMethods, ExpressionMethods, JoinOnDsl, + NullableExpressionMethods, QueryDsl, }; use diesel_async::RunQueryDsl; use lemmy_db_schema::{ aliases, newtypes::{CommunityId, PersonId, PostReportId}, schema::{ - community, - community_moderator, - community_person_ban, - person, - post, - post_aggregates, - post_like, + community, community_moderator, community_person_ban, person, post, post_aggregates, post_like, post_report, }, utils::{get_conn, limit_and_offset, DbConn, DbPool, ListFn, Queries, ReadFn}, diff --git a/crates/db_views/src/post_view.rs b/crates/db_views/src/post_view.rs index 87c31d7e5..085776c2c 100644 --- a/crates/db_views/src/post_view.rs +++ b/crates/db_views/src/post_view.rs @@ -7,41 +7,21 @@ use diesel::{ result::Error, sql_function, sql_types::{self, SingleValue, SqlType, Timestamptz}, - BoolExpressionMethods, - BoxableExpression, - Expression, - ExpressionMethods, - IntoSql, - JoinOnDsl, - NullableExpressionMethods, - OptionalExtension, - PgTextExpressionMethods, - QueryDsl, + BoolExpressionMethods, BoxableExpression, Expression, ExpressionMethods, IntoSql, JoinOnDsl, + NullableExpressionMethods, OptionalExtension, PgTextExpressionMethods, QueryDsl, }; use diesel_async::RunQueryDsl; use lemmy_db_schema::{ aggregates::structs::PostAggregates, newtypes::{CommunityId, LocalUserId, PersonId, PostId}, schema::{ - community, - community_block, - community_follower, - community_moderator, - community_person_ban, - instance_block, - local_user_language, - person, - person_block, - person_post_aggregates, - post, + community, community_block, community_follower, community_moderator, community_person_ban, + instance_block, local_user_language, person, person_block, person_post_aggregates, post, post_aggregates::{self, newest_comment_time}, - post_like, - post_read, - post_saved, + post_like, post_read, post_saved, }, utils::{fuzzy_search, get_conn, limit_and_offset, DbConn, DbPool, ListFn, Queries, ReadFn}, - ListingType, - SortType, + ListingType, SortType, }; use tracing::debug; @@ -442,13 +422,7 @@ fn queries<'a>() -> Queries< { use post_aggregates::{ - comments, - controversy_rank, - hot_rank, - hot_rank_active, - published, - scaled_rank, - score, + comments, controversy_rank, hot_rank, hot_rank_active, published, scaled_rank, score, }; match options.sort.as_ref().unwrap_or(&SortType::Hot) { SortType::Active => { @@ -623,9 +597,7 @@ impl<'a> PostQuery<'a> { use lemmy_db_schema::schema::{ community_aggregates::dsl::{community_aggregates, community_id, users_active_month}, community_follower::dsl::{ - community_follower, - community_id as follower_community_id, - person_id, + community_follower, community_id as follower_community_id, person_id, }, }; let (limit, offset) = limit_and_offset(self.page, self.limit)?; @@ -723,8 +695,7 @@ mod tests { }, traits::{Blockable, Crud, Likeable}, utils::{build_db_pool_for_tests, DbPool}, - SortType, - SubscribedType, + SortType, SubscribedType, }; use serial_test::serial; diff --git a/crates/db_views/src/private_message_report_view.rs b/crates/db_views/src/private_message_report_view.rs index 878d79edb..d989683de 100644 --- a/crates/db_views/src/private_message_report_view.rs +++ b/crates/db_views/src/private_message_report_view.rs @@ -1,11 +1,6 @@ use crate::structs::PrivateMessageReportView; use diesel::{ - pg::Pg, - result::Error, - ExpressionMethods, - JoinOnDsl, - NullableExpressionMethods, - QueryDsl, + pg::Pg, result::Error, ExpressionMethods, JoinOnDsl, NullableExpressionMethods, QueryDsl, }; use diesel_async::RunQueryDsl; use lemmy_db_schema::{ diff --git a/crates/db_views/src/private_message_view.rs b/crates/db_views/src/private_message_view.rs index b8628ecc5..5efb40ba3 100644 --- a/crates/db_views/src/private_message_view.rs +++ b/crates/db_views/src/private_message_view.rs @@ -1,12 +1,6 @@ use crate::structs::PrivateMessageView; use diesel::{ - debug_query, - pg::Pg, - result::Error, - BoolExpressionMethods, - ExpressionMethods, - JoinOnDsl, - QueryDsl, + debug_query, pg::Pg, result::Error, BoolExpressionMethods, ExpressionMethods, JoinOnDsl, QueryDsl, }; use diesel_async::RunQueryDsl; use lemmy_db_schema::{ diff --git a/crates/db_views/src/registration_application_view.rs b/crates/db_views/src/registration_application_view.rs index 6a2ed6133..203483ca3 100644 --- a/crates/db_views/src/registration_application_view.rs +++ b/crates/db_views/src/registration_application_view.rs @@ -1,11 +1,6 @@ use crate::structs::RegistrationApplicationView; use diesel::{ - dsl::count, - pg::Pg, - result::Error, - ExpressionMethods, - JoinOnDsl, - NullableExpressionMethods, + dsl::count, pg::Pg, result::Error, ExpressionMethods, JoinOnDsl, NullableExpressionMethods, QueryDsl, }; use diesel_async::RunQueryDsl; @@ -130,8 +125,7 @@ mod tests { #![allow(clippy::indexing_slicing)] use crate::registration_application_view::{ - RegistrationApplicationQuery, - RegistrationApplicationView, + RegistrationApplicationQuery, RegistrationApplicationView, }; use lemmy_db_schema::{ source::{ @@ -139,8 +133,7 @@ mod tests { local_user::{LocalUser, LocalUserInsertForm, LocalUserUpdateForm}, person::{Person, PersonInsertForm}, registration_application::{ - RegistrationApplication, - RegistrationApplicationInsertForm, + RegistrationApplication, RegistrationApplicationInsertForm, RegistrationApplicationUpdateForm, }, }, diff --git a/crates/db_views/src/structs.rs b/crates/db_views/src/structs.rs index 10847b053..a51537f11 100644 --- a/crates/db_views/src/structs.rs +++ b/crates/db_views/src/structs.rs @@ -3,21 +3,12 @@ use diesel::Queryable; use lemmy_db_schema::{ aggregates::structs::{CommentAggregates, PersonAggregates, PostAggregates, SiteAggregates}, source::{ - comment::Comment, - comment_report::CommentReport, - community::Community, - custom_emoji::CustomEmoji, - custom_emoji_keyword::CustomEmojiKeyword, - local_site::LocalSite, - local_site_rate_limit::LocalSiteRateLimit, - local_user::LocalUser, - person::Person, - post::Post, - post_report::PostReport, - private_message::PrivateMessage, + comment::Comment, comment_report::CommentReport, community::Community, + custom_emoji::CustomEmoji, custom_emoji_keyword::CustomEmojiKeyword, local_site::LocalSite, + local_site_rate_limit::LocalSiteRateLimit, local_user::LocalUser, person::Person, post::Post, + post_report::PostReport, private_message::PrivateMessage, private_message_report::PrivateMessageReport, - registration_application::RegistrationApplication, - site::Site, + registration_application::RegistrationApplication, site::Site, }, SubscribedType, }; diff --git a/crates/db_views_actor/src/comment_reply_view.rs b/crates/db_views_actor/src/comment_reply_view.rs index a97ad96fb..217a8f7fc 100644 --- a/crates/db_views_actor/src/comment_reply_view.rs +++ b/crates/db_views_actor/src/comment_reply_view.rs @@ -1,29 +1,15 @@ use crate::structs::CommentReplyView; use diesel::{ - pg::Pg, - result::Error, - BoolExpressionMethods, - ExpressionMethods, - JoinOnDsl, - NullableExpressionMethods, - QueryDsl, + pg::Pg, result::Error, BoolExpressionMethods, ExpressionMethods, JoinOnDsl, + NullableExpressionMethods, QueryDsl, }; use diesel_async::RunQueryDsl; use lemmy_db_schema::{ aliases, newtypes::{CommentReplyId, PersonId}, schema::{ - comment, - comment_aggregates, - comment_like, - comment_reply, - comment_saved, - community, - community_follower, - community_person_ban, - person, - person_block, - post, + comment, comment_aggregates, comment_like, comment_reply, comment_saved, community, + community_follower, community_person_ban, person, person_block, post, }, source::community::CommunityFollower, utils::{get_conn, limit_and_offset, DbConn, DbPool, ListFn, Queries, ReadFn}, diff --git a/crates/db_views_actor/src/community_follower_view.rs b/crates/db_views_actor/src/community_follower_view.rs index b2eeda29e..585f94572 100644 --- a/crates/db_views_actor/src/community_follower_view.rs +++ b/crates/db_views_actor/src/community_follower_view.rs @@ -3,8 +3,7 @@ use chrono::Utc; use diesel::{ dsl::{count_star, not}, result::Error, - ExpressionMethods, - QueryDsl, + ExpressionMethods, QueryDsl, }; use diesel_async::RunQueryDsl; use lemmy_db_schema::{ diff --git a/crates/db_views_actor/src/community_moderator_view.rs b/crates/db_views_actor/src/community_moderator_view.rs index 63e711225..81c9a4f33 100644 --- a/crates/db_views_actor/src/community_moderator_view.rs +++ b/crates/db_views_actor/src/community_moderator_view.rs @@ -14,9 +14,7 @@ impl CommunityModeratorView { find_person_id: PersonId, ) -> Result { use lemmy_db_schema::schema::community_moderator::dsl::{ - community_id, - community_moderator, - person_id, + community_id, community_moderator, person_id, }; let conn = &mut get_conn(pool).await?; select(exists( diff --git a/crates/db_views_actor/src/community_view.rs b/crates/db_views_actor/src/community_view.rs index f646e21f8..f15caec4d 100644 --- a/crates/db_views_actor/src/community_view.rs +++ b/crates/db_views_actor/src/community_view.rs @@ -1,29 +1,18 @@ use crate::structs::{CommunityModeratorView, CommunityView, PersonView}; use diesel::{ - pg::Pg, - result::Error, - BoolExpressionMethods, - ExpressionMethods, - JoinOnDsl, - NullableExpressionMethods, - PgTextExpressionMethods, - QueryDsl, + pg::Pg, result::Error, BoolExpressionMethods, ExpressionMethods, JoinOnDsl, + NullableExpressionMethods, PgTextExpressionMethods, QueryDsl, }; use diesel_async::RunQueryDsl; use lemmy_db_schema::{ newtypes::{CommunityId, PersonId}, schema::{ - community, - community_aggregates, - community_block, - community_follower, - instance_block, + community, community_aggregates, community_block, community_follower, instance_block, local_user, }, source::{community::CommunityFollower, local_user::LocalUser}, utils::{fuzzy_search, limit_and_offset, DbConn, DbPool, ListFn, Queries, ReadFn}, - ListingType, - SortType, + ListingType, SortType, }; fn queries<'a>() -> Queries< diff --git a/crates/db_views_actor/src/person_mention_view.rs b/crates/db_views_actor/src/person_mention_view.rs index 8d04f9820..78440f1c8 100644 --- a/crates/db_views_actor/src/person_mention_view.rs +++ b/crates/db_views_actor/src/person_mention_view.rs @@ -1,30 +1,15 @@ use crate::structs::PersonMentionView; use diesel::{ - dsl::now, - pg::Pg, - result::Error, - BoolExpressionMethods, - ExpressionMethods, - JoinOnDsl, - NullableExpressionMethods, - QueryDsl, + dsl::now, pg::Pg, result::Error, BoolExpressionMethods, ExpressionMethods, JoinOnDsl, + NullableExpressionMethods, QueryDsl, }; use diesel_async::RunQueryDsl; use lemmy_db_schema::{ aliases, newtypes::{PersonId, PersonMentionId}, schema::{ - comment, - comment_aggregates, - comment_like, - comment_saved, - community, - community_follower, - community_person_ban, - person, - person_block, - person_mention, - post, + comment, comment_aggregates, comment_like, comment_saved, community, community_follower, + community_person_ban, person, person_block, person_mention, post, }, source::community::CommunityFollower, utils::{get_conn, limit_and_offset, DbConn, DbPool, ListFn, Queries, ReadFn}, diff --git a/crates/db_views_actor/src/person_view.rs b/crates/db_views_actor/src/person_view.rs index 042b04767..c751ae693 100644 --- a/crates/db_views_actor/src/person_view.rs +++ b/crates/db_views_actor/src/person_view.rs @@ -1,12 +1,7 @@ use crate::structs::PersonView; use diesel::{ - pg::Pg, - result::Error, - BoolExpressionMethods, - ExpressionMethods, - NullableExpressionMethods, - PgTextExpressionMethods, - QueryDsl, + pg::Pg, result::Error, BoolExpressionMethods, ExpressionMethods, NullableExpressionMethods, + PgTextExpressionMethods, QueryDsl, }; use diesel_async::RunQueryDsl; use lemmy_db_schema::{ diff --git a/crates/db_views_actor/src/structs.rs b/crates/db_views_actor/src/structs.rs index bdc9e6bbd..51f8d1bb3 100644 --- a/crates/db_views_actor/src/structs.rs +++ b/crates/db_views_actor/src/structs.rs @@ -3,14 +3,8 @@ use diesel::Queryable; use lemmy_db_schema::{ aggregates::structs::{CommentAggregates, CommunityAggregates, PersonAggregates}, source::{ - comment::Comment, - comment_reply::CommentReply, - community::Community, - instance::Instance, - person::Person, - person_mention::PersonMention, - post::Post, - site::Site, + comment::Comment, comment_reply::CommentReply, community::Community, instance::Instance, + person::Person, person_mention::PersonMention, post::Post, site::Site, }, SubscribedType, }; diff --git a/crates/db_views_moderator/src/admin_purge_comment_view.rs b/crates/db_views_moderator/src/admin_purge_comment_view.rs index f62fe0f22..26fe7267b 100644 --- a/crates/db_views_moderator/src/admin_purge_comment_view.rs +++ b/crates/db_views_moderator/src/admin_purge_comment_view.rs @@ -1,12 +1,7 @@ use crate::structs::{AdminPurgeCommentView, ModlogListParams}; use diesel::{ - result::Error, - BoolExpressionMethods, - ExpressionMethods, - IntoSql, - JoinOnDsl, - NullableExpressionMethods, - QueryDsl, + result::Error, BoolExpressionMethods, ExpressionMethods, IntoSql, JoinOnDsl, + NullableExpressionMethods, QueryDsl, }; use diesel_async::RunQueryDsl; use lemmy_db_schema::{ diff --git a/crates/db_views_moderator/src/admin_purge_community_view.rs b/crates/db_views_moderator/src/admin_purge_community_view.rs index 23967ee3b..9a016c46d 100644 --- a/crates/db_views_moderator/src/admin_purge_community_view.rs +++ b/crates/db_views_moderator/src/admin_purge_community_view.rs @@ -1,12 +1,7 @@ use crate::structs::{AdminPurgeCommunityView, ModlogListParams}; use diesel::{ - result::Error, - BoolExpressionMethods, - ExpressionMethods, - IntoSql, - JoinOnDsl, - NullableExpressionMethods, - QueryDsl, + result::Error, BoolExpressionMethods, ExpressionMethods, IntoSql, JoinOnDsl, + NullableExpressionMethods, QueryDsl, }; use diesel_async::RunQueryDsl; use lemmy_db_schema::{ diff --git a/crates/db_views_moderator/src/admin_purge_person_view.rs b/crates/db_views_moderator/src/admin_purge_person_view.rs index 097785d25..d03cfca2c 100644 --- a/crates/db_views_moderator/src/admin_purge_person_view.rs +++ b/crates/db_views_moderator/src/admin_purge_person_view.rs @@ -1,12 +1,7 @@ use crate::structs::{AdminPurgePersonView, ModlogListParams}; use diesel::{ - result::Error, - BoolExpressionMethods, - ExpressionMethods, - IntoSql, - JoinOnDsl, - NullableExpressionMethods, - QueryDsl, + result::Error, BoolExpressionMethods, ExpressionMethods, IntoSql, JoinOnDsl, + NullableExpressionMethods, QueryDsl, }; use diesel_async::RunQueryDsl; use lemmy_db_schema::{ diff --git a/crates/db_views_moderator/src/admin_purge_post_view.rs b/crates/db_views_moderator/src/admin_purge_post_view.rs index 8f5eb3a14..3b400c60b 100644 --- a/crates/db_views_moderator/src/admin_purge_post_view.rs +++ b/crates/db_views_moderator/src/admin_purge_post_view.rs @@ -1,12 +1,7 @@ use crate::structs::{AdminPurgePostView, ModlogListParams}; use diesel::{ - result::Error, - BoolExpressionMethods, - ExpressionMethods, - IntoSql, - JoinOnDsl, - NullableExpressionMethods, - QueryDsl, + result::Error, BoolExpressionMethods, ExpressionMethods, IntoSql, JoinOnDsl, + NullableExpressionMethods, QueryDsl, }; use diesel_async::RunQueryDsl; use lemmy_db_schema::{ diff --git a/crates/db_views_moderator/src/mod_add_community_view.rs b/crates/db_views_moderator/src/mod_add_community_view.rs index f96a9b80b..73a15ebf7 100644 --- a/crates/db_views_moderator/src/mod_add_community_view.rs +++ b/crates/db_views_moderator/src/mod_add_community_view.rs @@ -1,12 +1,7 @@ use crate::structs::{ModAddCommunityView, ModlogListParams}; use diesel::{ - result::Error, - BoolExpressionMethods, - ExpressionMethods, - IntoSql, - JoinOnDsl, - NullableExpressionMethods, - QueryDsl, + result::Error, BoolExpressionMethods, ExpressionMethods, IntoSql, JoinOnDsl, + NullableExpressionMethods, QueryDsl, }; use diesel_async::RunQueryDsl; use lemmy_db_schema::{ diff --git a/crates/db_views_moderator/src/mod_add_view.rs b/crates/db_views_moderator/src/mod_add_view.rs index 28fb0a2b6..2769bd763 100644 --- a/crates/db_views_moderator/src/mod_add_view.rs +++ b/crates/db_views_moderator/src/mod_add_view.rs @@ -1,12 +1,7 @@ use crate::structs::{ModAddView, ModlogListParams}; use diesel::{ - result::Error, - BoolExpressionMethods, - ExpressionMethods, - IntoSql, - JoinOnDsl, - NullableExpressionMethods, - QueryDsl, + result::Error, BoolExpressionMethods, ExpressionMethods, IntoSql, JoinOnDsl, + NullableExpressionMethods, QueryDsl, }; use diesel_async::RunQueryDsl; use lemmy_db_schema::{ diff --git a/crates/db_views_moderator/src/mod_ban_from_community_view.rs b/crates/db_views_moderator/src/mod_ban_from_community_view.rs index 02f18099c..666eb5a76 100644 --- a/crates/db_views_moderator/src/mod_ban_from_community_view.rs +++ b/crates/db_views_moderator/src/mod_ban_from_community_view.rs @@ -1,12 +1,7 @@ use crate::structs::{ModBanFromCommunityView, ModlogListParams}; use diesel::{ - result::Error, - BoolExpressionMethods, - ExpressionMethods, - IntoSql, - JoinOnDsl, - NullableExpressionMethods, - QueryDsl, + result::Error, BoolExpressionMethods, ExpressionMethods, IntoSql, JoinOnDsl, + NullableExpressionMethods, QueryDsl, }; use diesel_async::RunQueryDsl; use lemmy_db_schema::{ diff --git a/crates/db_views_moderator/src/mod_ban_view.rs b/crates/db_views_moderator/src/mod_ban_view.rs index 94ac360db..555689f64 100644 --- a/crates/db_views_moderator/src/mod_ban_view.rs +++ b/crates/db_views_moderator/src/mod_ban_view.rs @@ -1,12 +1,7 @@ use crate::structs::{ModBanView, ModlogListParams}; use diesel::{ - result::Error, - BoolExpressionMethods, - ExpressionMethods, - IntoSql, - JoinOnDsl, - NullableExpressionMethods, - QueryDsl, + result::Error, BoolExpressionMethods, ExpressionMethods, IntoSql, JoinOnDsl, + NullableExpressionMethods, QueryDsl, }; use diesel_async::RunQueryDsl; use lemmy_db_schema::{ diff --git a/crates/db_views_moderator/src/mod_feature_post_view.rs b/crates/db_views_moderator/src/mod_feature_post_view.rs index 324816178..c7f7f0f27 100644 --- a/crates/db_views_moderator/src/mod_feature_post_view.rs +++ b/crates/db_views_moderator/src/mod_feature_post_view.rs @@ -1,12 +1,7 @@ use crate::structs::{ModFeaturePostView, ModlogListParams}; use diesel::{ - result::Error, - BoolExpressionMethods, - ExpressionMethods, - IntoSql, - JoinOnDsl, - NullableExpressionMethods, - QueryDsl, + result::Error, BoolExpressionMethods, ExpressionMethods, IntoSql, JoinOnDsl, + NullableExpressionMethods, QueryDsl, }; use diesel_async::RunQueryDsl; use lemmy_db_schema::{ diff --git a/crates/db_views_moderator/src/mod_hide_community_view.rs b/crates/db_views_moderator/src/mod_hide_community_view.rs index 36b549814..eaaedde99 100644 --- a/crates/db_views_moderator/src/mod_hide_community_view.rs +++ b/crates/db_views_moderator/src/mod_hide_community_view.rs @@ -1,12 +1,7 @@ use crate::structs::{ModHideCommunityView, ModlogListParams}; use diesel::{ - result::Error, - BoolExpressionMethods, - ExpressionMethods, - IntoSql, - JoinOnDsl, - NullableExpressionMethods, - QueryDsl, + result::Error, BoolExpressionMethods, ExpressionMethods, IntoSql, JoinOnDsl, + NullableExpressionMethods, QueryDsl, }; use diesel_async::RunQueryDsl; use lemmy_db_schema::{ diff --git a/crates/db_views_moderator/src/mod_lock_post_view.rs b/crates/db_views_moderator/src/mod_lock_post_view.rs index 7351b4f29..720417014 100644 --- a/crates/db_views_moderator/src/mod_lock_post_view.rs +++ b/crates/db_views_moderator/src/mod_lock_post_view.rs @@ -1,12 +1,7 @@ use crate::structs::{ModLockPostView, ModlogListParams}; use diesel::{ - result::Error, - BoolExpressionMethods, - ExpressionMethods, - IntoSql, - JoinOnDsl, - NullableExpressionMethods, - QueryDsl, + result::Error, BoolExpressionMethods, ExpressionMethods, IntoSql, JoinOnDsl, + NullableExpressionMethods, QueryDsl, }; use diesel_async::RunQueryDsl; use lemmy_db_schema::{ diff --git a/crates/db_views_moderator/src/mod_remove_comment_view.rs b/crates/db_views_moderator/src/mod_remove_comment_view.rs index 9b8a71a7b..d75838bee 100644 --- a/crates/db_views_moderator/src/mod_remove_comment_view.rs +++ b/crates/db_views_moderator/src/mod_remove_comment_view.rs @@ -1,12 +1,7 @@ use crate::structs::{ModRemoveCommentView, ModlogListParams}; use diesel::{ - result::Error, - BoolExpressionMethods, - ExpressionMethods, - IntoSql, - JoinOnDsl, - NullableExpressionMethods, - QueryDsl, + result::Error, BoolExpressionMethods, ExpressionMethods, IntoSql, JoinOnDsl, + NullableExpressionMethods, QueryDsl, }; use diesel_async::RunQueryDsl; use lemmy_db_schema::{ diff --git a/crates/db_views_moderator/src/mod_remove_community_view.rs b/crates/db_views_moderator/src/mod_remove_community_view.rs index 2bc92acc8..d3f88d001 100644 --- a/crates/db_views_moderator/src/mod_remove_community_view.rs +++ b/crates/db_views_moderator/src/mod_remove_community_view.rs @@ -1,12 +1,7 @@ use crate::structs::{ModRemoveCommunityView, ModlogListParams}; use diesel::{ - result::Error, - BoolExpressionMethods, - ExpressionMethods, - IntoSql, - JoinOnDsl, - NullableExpressionMethods, - QueryDsl, + result::Error, BoolExpressionMethods, ExpressionMethods, IntoSql, JoinOnDsl, + NullableExpressionMethods, QueryDsl, }; use diesel_async::RunQueryDsl; use lemmy_db_schema::{ diff --git a/crates/db_views_moderator/src/mod_remove_post_view.rs b/crates/db_views_moderator/src/mod_remove_post_view.rs index 60469088c..ae6dde442 100644 --- a/crates/db_views_moderator/src/mod_remove_post_view.rs +++ b/crates/db_views_moderator/src/mod_remove_post_view.rs @@ -1,12 +1,7 @@ use crate::structs::{ModRemovePostView, ModlogListParams}; use diesel::{ - result::Error, - BoolExpressionMethods, - ExpressionMethods, - IntoSql, - JoinOnDsl, - NullableExpressionMethods, - QueryDsl, + result::Error, BoolExpressionMethods, ExpressionMethods, IntoSql, JoinOnDsl, + NullableExpressionMethods, QueryDsl, }; use diesel_async::RunQueryDsl; use lemmy_db_schema::{ diff --git a/crates/db_views_moderator/src/mod_transfer_community_view.rs b/crates/db_views_moderator/src/mod_transfer_community_view.rs index 3d48b0f67..540d9a583 100644 --- a/crates/db_views_moderator/src/mod_transfer_community_view.rs +++ b/crates/db_views_moderator/src/mod_transfer_community_view.rs @@ -1,12 +1,7 @@ use crate::structs::{ModTransferCommunityView, ModlogListParams}; use diesel::{ - result::Error, - BoolExpressionMethods, - ExpressionMethods, - IntoSql, - JoinOnDsl, - NullableExpressionMethods, - QueryDsl, + result::Error, BoolExpressionMethods, ExpressionMethods, IntoSql, JoinOnDsl, + NullableExpressionMethods, QueryDsl, }; use diesel_async::RunQueryDsl; use lemmy_db_schema::{ diff --git a/crates/db_views_moderator/src/structs.rs b/crates/db_views_moderator/src/structs.rs index 549b38796..edfa69dea 100644 --- a/crates/db_views_moderator/src/structs.rs +++ b/crates/db_views_moderator/src/structs.rs @@ -6,21 +6,9 @@ use lemmy_db_schema::{ comment::Comment, community::Community, moderator::{ - AdminPurgeComment, - AdminPurgeCommunity, - AdminPurgePerson, - AdminPurgePost, - ModAdd, - ModAddCommunity, - ModBan, - ModBanFromCommunity, - ModFeaturePost, - ModHideCommunity, - ModLockPost, - ModRemoveComment, - ModRemoveCommunity, - ModRemovePost, - ModTransferCommunity, + AdminPurgeComment, AdminPurgeCommunity, AdminPurgePerson, AdminPurgePost, ModAdd, + ModAddCommunity, ModBan, ModBanFromCommunity, ModFeaturePost, ModHideCommunity, ModLockPost, + ModRemoveComment, ModRemoveCommunity, ModRemovePost, ModTransferCommunity, }, person::Person, post::Post, diff --git a/crates/federate/src/federation_queue_state.rs b/crates/federate/src/federation_queue_state.rs index 8a3506121..56bcfa957 100644 --- a/crates/federate/src/federation_queue_state.rs +++ b/crates/federate/src/federation_queue_state.rs @@ -25,8 +25,7 @@ impl FederationQueueState { instance_id_: InstanceId, ) -> Result { use lemmy_db_schema::schema::federation_queue_state::dsl::{ - federation_queue_state, - instance_id, + federation_queue_state, instance_id, }; let conn = &mut get_conn(pool).await?; Ok( @@ -46,8 +45,7 @@ impl FederationQueueState { } pub async fn upsert(pool: &mut DbPool<'_>, state: &FederationQueueState) -> Result<()> { use lemmy_db_schema::schema::federation_queue_state::dsl::{ - federation_queue_state, - instance_id, + federation_queue_state, instance_id, }; let conn = &mut get_conn(pool).await?; diff --git a/crates/federate/src/worker.rs b/crates/federate/src/worker.rs index 3eda2e746..10f1b5c6f 100644 --- a/crates/federate/src/worker.rs +++ b/crates/federate/src/worker.rs @@ -1,12 +1,8 @@ use crate::{ federation_queue_state::FederationQueueState, util::{ - get_activity_cached, - get_actor_cached, - get_latest_activity_id, - retry_sleep_duration, - LEMMY_TEST_FAST_FEDERATION, - WORK_FINISHED_RECHECK_DELAY, + get_activity_cached, get_actor_cached, get_latest_activity_id, retry_sleep_duration, + LEMMY_TEST_FAST_FEDERATION, WORK_FINISHED_RECHECK_DELAY, }, }; use activitypub_federation::{activity_sending::SendActivityTask, config::Data}; diff --git a/crates/routes/src/feeds.rs b/crates/routes/src/feeds.rs index 49cef6d41..59f0c31a4 100644 --- a/crates/routes/src/feeds.rs +++ b/crates/routes/src/feeds.rs @@ -7,9 +7,7 @@ use lemmy_db_schema::{ source::{community::Community, local_user::LocalUser, person::Person}, traits::{ApubActor, Crud}, utils::DbPool, - CommentSortType, - ListingType, - SortType, + CommentSortType, ListingType, SortType, }; use lemmy_db_views::{ post_view::PostQuery, @@ -21,18 +19,11 @@ use lemmy_db_views_actor::{ structs::{CommentReplyView, PersonMentionView}, }; use lemmy_utils::{ - cache_header::cache_1hour, - claims::Claims, - error::LemmyError, - utils::markdown::markdown_to_html, + cache_header::cache_1hour, claims::Claims, error::LemmyError, utils::markdown::markdown_to_html, }; use once_cell::sync::Lazy; use rss::{ - extension::dublincore::DublinCoreExtensionBuilder, - ChannelBuilder, - GuidBuilder, - Item, - ItemBuilder, + extension::dublincore::DublinCoreExtensionBuilder, ChannelBuilder, GuidBuilder, Item, ItemBuilder, }; use serde::Deserialize; use std::{collections::BTreeMap, str::FromStr}; diff --git a/crates/routes/src/images.rs b/crates/routes/src/images.rs index db3341418..b73834759 100644 --- a/crates/routes/src/images.rs +++ b/crates/routes/src/images.rs @@ -5,10 +5,7 @@ use actix_web::{ header::{HeaderName, ACCEPT_ENCODING, HOST}, StatusCode, }, - web, - Error, - HttpRequest, - HttpResponse, + web, Error, HttpRequest, HttpResponse, }; use futures::stream::{Stream, StreamExt}; use lemmy_api_common::context::LemmyContext; diff --git a/crates/utils/src/email.rs b/crates/utils/src/email.rs index fdff19033..e166cf763 100644 --- a/crates/utils/src/email.rs +++ b/crates/utils/src/email.rs @@ -6,9 +6,7 @@ use html2text; use lettre::{ message::{Mailbox, MultiPart}, transport::smtp::{authentication::Credentials, extension::ClientId}, - Address, - AsyncTransport, - Message, + Address, AsyncTransport, Message, }; use std::str::FromStr; use uuid::Uuid; diff --git a/crates/utils/src/response.rs b/crates/utils/src/response.rs index cc0b7c707..baa9f7e94 100644 --- a/crates/utils/src/response.rs +++ b/crates/utils/src/response.rs @@ -1,9 +1,6 @@ use crate::error::{LemmyError, LemmyErrorType}; use actix_web::{ - dev::ServiceResponse, - http::header, - middleware::ErrorHandlerResponse, - HttpResponse, + dev::ServiceResponse, http::header, middleware::ErrorHandlerResponse, HttpResponse, }; pub fn jsonify_plain_text_errors( @@ -43,13 +40,7 @@ mod tests { use super::*; use crate::error::{LemmyError, LemmyErrorType}; use actix_web::{ - error::ErrorInternalServerError, - middleware::ErrorHandlers, - test, - web, - App, - Error, - Handler, + error::ErrorInternalServerError, middleware::ErrorHandlers, test, web, App, Error, Handler, Responder, }; use http::StatusCode; diff --git a/crates/utils/src/utils/markdown/spoiler_rule.rs b/crates/utils/src/utils/markdown/spoiler_rule.rs index bae858bfd..bbb16815f 100644 --- a/crates/utils/src/utils/markdown/spoiler_rule.rs +++ b/crates/utils/src/utils/markdown/spoiler_rule.rs @@ -29,10 +29,7 @@ use markdown_it::{ block::{BlockRule, BlockState}, inline::InlineRoot, }, - MarkdownIt, - Node, - NodeValue, - Renderer, + MarkdownIt, Node, NodeValue, Renderer, }; use once_cell::sync::Lazy; use regex::Regex; diff --git a/crates/utils/src/utils/validation.rs b/crates/utils/src/utils/validation.rs index f2b8fa2a7..c8d0caa36 100644 --- a/crates/utils/src/utils/validation.rs +++ b/crates/utils/src/utils/validation.rs @@ -273,20 +273,10 @@ mod tests { use crate::{ error::LemmyErrorType, utils::validation::{ - build_and_check_regex, - check_site_visibility_valid, - check_url_scheme, - clean_url_params, - is_valid_actor_name, - is_valid_bio_field, - is_valid_display_name, - is_valid_matrix_id, - is_valid_post_title, - site_description_length_check, - site_name_length_check, - BIO_MAX_LENGTH, - SITE_DESCRIPTION_MAX_LENGTH, - SITE_NAME_MAX_LENGTH, + build_and_check_regex, check_site_visibility_valid, check_url_scheme, clean_url_params, + is_valid_actor_name, is_valid_bio_field, is_valid_display_name, is_valid_matrix_id, + is_valid_post_title, site_description_length_check, site_name_length_check, BIO_MAX_LENGTH, + SITE_DESCRIPTION_MAX_LENGTH, SITE_NAME_MAX_LENGTH, }, }; use url::Url; diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 3a68ea131..9659571d6 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -55,14 +55,14 @@ services: lemmy-ui: # use "image" to pull down an already compiled lemmy-ui. make sure to comment out "build". - image: dessalines/lemmy-ui:0.18.1 + # image: dessalines/lemmy-ui:0.18.1 # platform: linux/x86_64 # no arm64 support. uncomment platform if using m1. # use "build" to build your local lemmy ui image for development. make sure to comment out "image". # run: docker compose up --build - # build: - # context: ../../lemmy-ui # assuming lemmy-ui is cloned besides lemmy directory - # dockerfile: dev.dockerfile + build: + context: ../../lemmy-ui # assuming lemmy-ui is cloned besides lemmy directory + dockerfile: dev.dockerfile environment: # this needs to match the hostname defined in the lemmy service - LEMMY_UI_LEMMY_INTERNAL_HOST=lemmy:8536 diff --git a/docker/federation/docker-compose.yml b/docker/federation/docker-compose.yml index 634a97449..272723fc2 100644 --- a/docker/federation/docker-compose.yml +++ b/docker/federation/docker-compose.yml @@ -2,11 +2,11 @@ version: "3.7" x-ui-default: &ui-default init: true - image: dessalines/lemmy-ui:0.18.4 + # image: dessalines/lemmy-ui:0.18.4 # assuming lemmy-ui is cloned besides lemmy directory - # build: - # context: ../../../lemmy-ui - # dockerfile: dev.dockerfile + build: + context: ../../../lemmy-ui + dockerfile: dev.dockerfile environment: - LEMMY_UI_HTTPS=false diff --git a/src/api_routes_http.rs b/src/api_routes_http.rs index fb62e82ec..030f051c3 100644 --- a/src/api_routes_http.rs +++ b/src/api_routes_http.rs @@ -2,17 +2,11 @@ use actix_web::{guard, web}; use lemmy_api::{ comment::{distinguish::distinguish_comment, like::like_comment, save::save_comment}, comment_report::{ - create::create_comment_report, - list::list_comment_reports, - resolve::resolve_comment_report, + create::create_comment_report, list::list_comment_reports, resolve::resolve_comment_report, }, community::{ - add_mod::add_mod_to_community, - ban::ban_from_community, - block::block_community, - follow::follow_community, - hide::hide_community, - transfer::transfer_community, + add_mod::add_mod_to_community, ban::ban_from_community, block::block_community, + follow::follow_community, hide::hide_community, transfer::transfer_community, }, local_user::{ add_admin::add_admin, @@ -25,12 +19,9 @@ use lemmy_api::{ list_banned::list_banned_users, login::login, notifications::{ - list_mentions::list_mentions, - list_replies::list_replies, - mark_all_read::mark_all_notifications_read, - mark_mention_read::mark_person_mention_as_read, - mark_reply_read::mark_reply_as_read, - unread_count::unread_count, + list_mentions::list_mentions, list_replies::list_replies, + mark_all_read::mark_all_notifications_read, mark_mention_read::mark_person_mention_as_read, + mark_reply_read::mark_reply_as_read, unread_count::unread_count, }, report_count::report_count, reset_password::reset_password, @@ -39,23 +30,15 @@ use lemmy_api::{ verify_email::verify_email, }, post::{ - feature::feature_post, - get_link_metadata::get_link_metadata, - like::like_post, - lock::lock_post, - mark_read::mark_post_as_read, - save::save_post, + feature::feature_post, get_link_metadata::get_link_metadata, like::like_post, lock::lock_post, + mark_read::mark_post_as_read, save::save_post, }, post_report::{ - create::create_post_report, - list::list_post_reports, - resolve::resolve_post_report, + create::create_post_report, list::list_post_reports, resolve::resolve_post_report, }, private_message::mark_read::mark_pm_as_read, private_message_report::{ - create::create_pm_report, - list::list_pm_reports, - resolve::resolve_pm_report, + create::create_pm_report, list::list_pm_reports, resolve::resolve_pm_report, }, site::{ block::block_instance, @@ -63,14 +46,10 @@ use lemmy_api::{ leave_admin::leave_admin, mod_log::get_mod_log, purge::{ - comment::purge_comment, - community::purge_community, - person::purge_person, - post::purge_post, + comment::purge_comment, community::purge_community, person::purge_person, post::purge_post, }, registration_applications::{ - approve::approve_registration_application, - list::list_registration_applications, + approve::approve_registration_application, list::list_registration_applications, unread_count::get_unread_registration_application_count, }, }, @@ -78,47 +57,30 @@ use lemmy_api::{ }; use lemmy_api_crud::{ comment::{ - create::create_comment, - delete::delete_comment, - read::get_comment, - remove::remove_comment, + create::create_comment, delete::delete_comment, read::get_comment, remove::remove_comment, update::update_comment, }, community::{ - create::create_community, - delete::delete_community, - list::list_communities, - remove::remove_community, - update::update_community, + create::create_community, delete::delete_community, list::list_communities, + remove::remove_community, update::update_community, }, custom_emoji::{ - create::create_custom_emoji, - delete::delete_custom_emoji, - update::update_custom_emoji, + create::create_custom_emoji, delete::delete_custom_emoji, update::update_custom_emoji, }, post::{ - create::create_post, - delete::delete_post, - read::get_post, - remove::remove_post, + create::create_post, delete::delete_post, read::get_post, remove::remove_post, update::update_post, }, private_message::{ - create::create_private_message, - delete::delete_private_message, - read::get_private_message, + create::create_private_message, delete::delete_private_message, read::get_private_message, update::update_private_message, }, site::{create::create_site, read::get_site, update::update_site}, user::{create::register, delete::delete_account}, }; use lemmy_apub::api::{ - list_comments::list_comments, - list_posts::list_posts, - read_community::get_community, - read_person::read_person, - resolve_object::resolve_object, - search::search, + list_comments::list_comments, list_posts::list_posts, read_community::get_community, + read_person::read_person, resolve_object::resolve_object, search::search, }; use lemmy_utils::rate_limit::RateLimitCell; diff --git a/src/code_migrations.rs b/src/code_migrations.rs index e274ca940..8b6bc351c 100644 --- a/src/code_migrations.rs +++ b/src/code_migrations.rs @@ -2,21 +2,14 @@ use activitypub_federation::http_signatures::generate_actor_keypair; use diesel::{ sql_types::{Nullable, Text}, - ExpressionMethods, - IntoSql, - QueryDsl, - TextExpressionMethods, + ExpressionMethods, IntoSql, QueryDsl, TextExpressionMethods, }; use diesel_async::RunQueryDsl; use lemmy_api_common::{ lemmy_db_views::structs::SiteView, utils::{ - generate_followers_url, - generate_inbox_url, - generate_local_apub_endpoint, - generate_shared_inbox_url, - generate_site_inbox_url, - EndpointType, + generate_followers_url, generate_inbox_url, generate_local_apub_endpoint, + generate_shared_inbox_url, generate_site_inbox_url, EndpointType, }, }; use lemmy_db_schema::{ @@ -308,10 +301,7 @@ async fn apub_columns_2021_02_02(pool: &mut DbPool<'_>) -> Result<(), LemmyError { use lemmy_db_schema::schema::community::dsl::{ - community, - followers_url, - inbox_url, - shared_inbox_url, + community, followers_url, inbox_url, shared_inbox_url, }; let communities = community .filter(inbox_url.like("http://changeme%")) diff --git a/src/lib.rs b/src/lib.rs index 9ce1bfa00..a24f56b95 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -9,8 +9,7 @@ pub mod session_middleware; pub mod telemetry; use crate::{ - code_migrations::run_advanced_migrations, - root_span_builder::QuieterRootSpanBuilder, + code_migrations::run_advanced_migrations, root_span_builder::QuieterRootSpanBuilder, session_middleware::SessionMiddleware, }; use activitypub_federation::config::{FederationConfig, FederationMiddleware}; @@ -19,9 +18,7 @@ use actix_web::{ dev::ServerHandle, middleware::{self, ErrorHandlers}, web::Data, - App, - HttpServer, - Result, + App, HttpServer, Result, }; use clap::{ArgAction, Parser}; use lemmy_api_common::{ @@ -30,14 +27,12 @@ use lemmy_api_common::{ request::build_user_agent, send_activity::{ActivityChannel, MATCH_OUTGOING_ACTIVITIES}, utils::{ - check_private_instance_and_federation_enabled, - local_site_rate_limit_to_rate_limit_config, + check_private_instance_and_federation_enabled, local_site_rate_limit_to_rate_limit_config, }, }; use lemmy_apub::{ activities::{handle_outgoing_activities, match_outgoing_activities}, - VerifyUrlData, - FEDERATION_HTTP_FETCH_LIMIT, + VerifyUrlData, FEDERATION_HTTP_FETCH_LIMIT, }; use lemmy_db_schema::{ source::secret::Secret, @@ -64,8 +59,7 @@ use tracing_subscriber::{filter::Targets, layer::SubscriberExt, Layer, Registry} use url::Url; #[cfg(feature = "prometheus-metrics")] use { - actix_web_prom::PrometheusMetricsBuilder, - prometheus::default_registry, + actix_web_prom::PrometheusMetricsBuilder, prometheus::default_registry, prometheus_metrics::serve_prometheus, }; diff --git a/src/scheduled_tasks.rs b/src/scheduled_tasks.rs index 99dd16829..08011e67a 100644 --- a/src/scheduled_tasks.rs +++ b/src/scheduled_tasks.rs @@ -4,22 +4,13 @@ use diesel::{ dsl::IntervalDsl, sql_query, sql_types::{Integer, Timestamptz}, - ExpressionMethods, - NullableExpressionMethods, - QueryDsl, - QueryableByName, + ExpressionMethods, NullableExpressionMethods, QueryDsl, QueryableByName, }; use diesel_async::{AsyncPgConnection, RunQueryDsl}; use lemmy_api_common::context::LemmyContext; use lemmy_db_schema::{ schema::{ - captcha_answer, - comment, - community_person_ban, - instance, - person, - post, - received_activity, + captcha_answer, comment, community_person_ban, instance, person, post, received_activity, sent_activity, }, source::instance::{Instance, InstanceForm},