diff --git a/crates/api/src/comment/save.rs b/crates/api/src/comment/save.rs index 9545b38a9..6b7d67352 100644 --- a/crates/api/src/comment/save.rs +++ b/crates/api/src/comment/save.rs @@ -19,7 +19,6 @@ impl Perform for SaveComment { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &SaveComment = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; diff --git a/crates/api/src/comment_report/create.rs b/crates/api/src/comment_report/create.rs index d910c6789..e04de88f6 100644 --- a/crates/api/src/comment_report/create.rs +++ b/crates/api/src/comment_report/create.rs @@ -26,7 +26,6 @@ impl Perform for CreateCommentReport { context: &Data, ) -> Result { let mut conn = context.conn().await?; - let data: &CreateCommentReport = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; let local_site = LocalSite::read(&mut conn).await?; diff --git a/crates/api/src/comment_report/resolve.rs b/crates/api/src/comment_report/resolve.rs index e11497385..41e62f141 100644 --- a/crates/api/src/comment_report/resolve.rs +++ b/crates/api/src/comment_report/resolve.rs @@ -20,7 +20,6 @@ impl Perform for ResolveCommentReport { context: &Data, ) -> Result { let mut conn = context.conn().await?; - let data: &ResolveCommentReport = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; diff --git a/crates/api/src/community/add_mod.rs b/crates/api/src/community/add_mod.rs index 8e113e538..4702f9261 100644 --- a/crates/api/src/community/add_mod.rs +++ b/crates/api/src/community/add_mod.rs @@ -25,7 +25,6 @@ impl Perform for AddModToCommunity { context: &Data, ) -> Result { let mut conn = context.conn().await?; - let data: &AddModToCommunity = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; diff --git a/crates/api/src/community/ban.rs b/crates/api/src/community/ban.rs index 797ae34af..fbb80ed50 100644 --- a/crates/api/src/community/ban.rs +++ b/crates/api/src/community/ban.rs @@ -33,7 +33,6 @@ impl Perform for BanFromCommunity { context: &Data, ) -> Result { let mut conn = context.conn().await?; - let data: &BanFromCommunity = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; diff --git a/crates/api/src/community/block.rs b/crates/api/src/community/block.rs index e488c3dd2..ec8dfd739 100644 --- a/crates/api/src/community/block.rs +++ b/crates/api/src/community/block.rs @@ -25,7 +25,6 @@ impl Perform for BlockCommunity { context: &Data, ) -> Result { let mut conn = context.conn().await?; - let data: &BlockCommunity = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; diff --git a/crates/api/src/community/follow.rs b/crates/api/src/community/follow.rs index ab3409066..bb998dcc3 100644 --- a/crates/api/src/community/follow.rs +++ b/crates/api/src/community/follow.rs @@ -22,7 +22,6 @@ impl Perform for FollowCommunity { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &FollowCommunity = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; diff --git a/crates/api/src/community/hide.rs b/crates/api/src/community/hide.rs index 611347b7c..54cb60326 100644 --- a/crates/api/src/community/hide.rs +++ b/crates/api/src/community/hide.rs @@ -22,7 +22,6 @@ impl Perform for HideCommunity { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &HideCommunity = self; // Verify its a admin (only admin can hide or unhide it) diff --git a/crates/api/src/community/transfer.rs b/crates/api/src/community/transfer.rs index 874c9c11a..17e3feddf 100644 --- a/crates/api/src/community/transfer.rs +++ b/crates/api/src/community/transfer.rs @@ -28,7 +28,6 @@ impl Perform for TransferCommunity { context: &Data, ) -> Result { let mut conn = context.conn().await?; - let data: &TransferCommunity = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; diff --git a/crates/api/src/lib.rs b/crates/api/src/lib.rs index a3d42c046..632e2c3bd 100644 --- a/crates/api/src/lib.rs +++ b/crates/api/src/lib.rs @@ -70,7 +70,6 @@ mod tests { #[serial] async fn test_should_not_validate_user_token_after_password_change() { let conn = &mut build_db_conn_for_tests().await; - let secret = Secret::init(conn).await.unwrap(); let settings = &SETTINGS.to_owned(); diff --git a/crates/api/src/local_user/add_admin.rs b/crates/api/src/local_user/add_admin.rs index 4b6988e94..23a1c53db 100644 --- a/crates/api/src/local_user/add_admin.rs +++ b/crates/api/src/local_user/add_admin.rs @@ -22,7 +22,6 @@ impl Perform for AddAdmin { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &AddAdmin = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; diff --git a/crates/api/src/local_user/ban_person.rs b/crates/api/src/local_user/ban_person.rs index ac9c92634..425cc588f 100644 --- a/crates/api/src/local_user/ban_person.rs +++ b/crates/api/src/local_user/ban_person.rs @@ -25,7 +25,6 @@ impl Perform for BanPerson { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &BanPerson = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; diff --git a/crates/api/src/local_user/block.rs b/crates/api/src/local_user/block.rs index 8f1566489..ea30202d8 100644 --- a/crates/api/src/local_user/block.rs +++ b/crates/api/src/local_user/block.rs @@ -19,7 +19,6 @@ impl Perform for BlockPerson { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &BlockPerson = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; diff --git a/crates/api/src/local_user/change_password.rs b/crates/api/src/local_user/change_password.rs index 3ce3d7253..64255b224 100644 --- a/crates/api/src/local_user/change_password.rs +++ b/crates/api/src/local_user/change_password.rs @@ -16,7 +16,6 @@ impl Perform for ChangePassword { #[tracing::instrument(skip(self, context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &ChangePassword = self; let local_user_view = local_user_view_from_jwt(data.auth.as_ref(), context).await?; 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 ac216335b..2203c33a7 100644 --- a/crates/api/src/local_user/change_password_after_reset.rs +++ b/crates/api/src/local_user/change_password_after_reset.rs @@ -19,7 +19,6 @@ impl Perform for PasswordChangeAfterReset { #[tracing::instrument(skip(self, context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &PasswordChangeAfterReset = self; // Fetch the user_id from the token diff --git a/crates/api/src/local_user/get_captcha.rs b/crates/api/src/local_user/get_captcha.rs index f45735834..45e16bcee 100644 --- a/crates/api/src/local_user/get_captcha.rs +++ b/crates/api/src/local_user/get_captcha.rs @@ -18,7 +18,6 @@ impl Perform for GetCaptcha { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let local_site = LocalSite::read(&mut conn).await?; if !local_site.captcha_enabled { diff --git a/crates/api/src/local_user/list_banned.rs b/crates/api/src/local_user/list_banned.rs index 88c909144..47ce5bc84 100644 --- a/crates/api/src/local_user/list_banned.rs +++ b/crates/api/src/local_user/list_banned.rs @@ -14,7 +14,6 @@ impl Perform for GetBannedPersons { async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &GetBannedPersons = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; diff --git a/crates/api/src/local_user/login.rs b/crates/api/src/local_user/login.rs index 8be321476..a188ddb19 100644 --- a/crates/api/src/local_user/login.rs +++ b/crates/api/src/local_user/login.rs @@ -16,7 +16,6 @@ impl Perform for Login { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &Login = self; let site_view = SiteView::read_local(&mut conn).await?; diff --git a/crates/api/src/local_user/notifications/list_mentions.rs b/crates/api/src/local_user/notifications/list_mentions.rs index 31b47f830..7b6d9b6cf 100644 --- a/crates/api/src/local_user/notifications/list_mentions.rs +++ b/crates/api/src/local_user/notifications/list_mentions.rs @@ -28,7 +28,6 @@ impl Perform for GetPersonMentions { let show_bot_accounts = Some(local_user_view.local_user.show_bot_accounts); let mut conn = context.conn().await?; - let mentions = PersonMentionQuery::builder() .conn(&mut conn) .recipient_id(person_id) diff --git a/crates/api/src/local_user/notifications/list_replies.rs b/crates/api/src/local_user/notifications/list_replies.rs index f328fca5d..bb427c4e4 100644 --- a/crates/api/src/local_user/notifications/list_replies.rs +++ b/crates/api/src/local_user/notifications/list_replies.rs @@ -25,7 +25,6 @@ impl Perform for GetReplies { let show_bot_accounts = Some(local_user_view.local_user.show_bot_accounts); let mut conn = context.conn().await?; - let replies = CommentReplyQuery::builder() .conn(&mut conn) .recipient_id(person_id) 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 8d86eeb48..766515330 100644 --- a/crates/api/src/local_user/notifications/mark_all_read.rs +++ b/crates/api/src/local_user/notifications/mark_all_read.rs @@ -19,7 +19,6 @@ impl Perform for MarkAllAsRead { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &MarkAllAsRead = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; let person_id = local_user_view.person.id; diff --git a/crates/api/src/local_user/notifications/mark_mention_read.rs b/crates/api/src/local_user/notifications/mark_mention_read.rs index 62d1ddbad..4dc31cc03 100644 --- a/crates/api/src/local_user/notifications/mark_mention_read.rs +++ b/crates/api/src/local_user/notifications/mark_mention_read.rs @@ -22,7 +22,6 @@ impl Perform for MarkPersonMentionAsRead { context: &Data, ) -> Result { let mut conn = context.conn().await?; - let data: &MarkPersonMentionAsRead = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; diff --git a/crates/api/src/local_user/notifications/mark_reply_read.rs b/crates/api/src/local_user/notifications/mark_reply_read.rs index 0c5b07515..4de8524d8 100644 --- a/crates/api/src/local_user/notifications/mark_reply_read.rs +++ b/crates/api/src/local_user/notifications/mark_reply_read.rs @@ -22,7 +22,6 @@ impl Perform for MarkCommentReplyAsRead { context: &Data, ) -> Result { let mut conn = context.conn().await?; - let data = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; diff --git a/crates/api/src/local_user/notifications/unread_count.rs b/crates/api/src/local_user/notifications/unread_count.rs index e7a2348ca..ab7c59d7c 100644 --- a/crates/api/src/local_user/notifications/unread_count.rs +++ b/crates/api/src/local_user/notifications/unread_count.rs @@ -16,7 +16,6 @@ impl Perform for GetUnreadCount { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; diff --git a/crates/api/src/local_user/report_count.rs b/crates/api/src/local_user/report_count.rs index 6faa13d94..e130a302b 100644 --- a/crates/api/src/local_user/report_count.rs +++ b/crates/api/src/local_user/report_count.rs @@ -18,7 +18,6 @@ impl Perform for GetReportCount { context: &Data, ) -> Result { let mut conn = context.conn().await?; - let data: &GetReportCount = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; diff --git a/crates/api/src/local_user/reset_password.rs b/crates/api/src/local_user/reset_password.rs index d04806700..29411cae0 100644 --- a/crates/api/src/local_user/reset_password.rs +++ b/crates/api/src/local_user/reset_password.rs @@ -19,7 +19,6 @@ impl Perform for PasswordReset { context: &Data, ) -> Result { let mut conn = context.conn().await?; - let data: &PasswordReset = self; // Fetch that email diff --git a/crates/api/src/local_user/save_settings.rs b/crates/api/src/local_user/save_settings.rs index 7b7c53c76..1356e895f 100644 --- a/crates/api/src/local_user/save_settings.rs +++ b/crates/api/src/local_user/save_settings.rs @@ -34,7 +34,6 @@ impl Perform for SaveUserSettings { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &SaveUserSettings = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; let site_view = SiteView::read_local(&mut conn).await?; diff --git a/crates/api/src/local_user/verify_email.rs b/crates/api/src/local_user/verify_email.rs index 9f7db3991..2d9006f22 100644 --- a/crates/api/src/local_user/verify_email.rs +++ b/crates/api/src/local_user/verify_email.rs @@ -19,7 +19,6 @@ impl Perform for VerifyEmail { async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let token = self.token.clone(); let verification = EmailVerification::read_for_token(&mut conn, &token) .await diff --git a/crates/api/src/post/feature.rs b/crates/api/src/post/feature.rs index f42c1eb62..50b583010 100644 --- a/crates/api/src/post/feature.rs +++ b/crates/api/src/post/feature.rs @@ -29,7 +29,6 @@ impl Perform for FeaturePost { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &FeaturePost = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; diff --git a/crates/api/src/post/like.rs b/crates/api/src/post/like.rs index 8d07cba91..3ba8747bc 100644 --- a/crates/api/src/post/like.rs +++ b/crates/api/src/post/like.rs @@ -28,7 +28,6 @@ impl Perform for CreatePostLike { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &CreatePostLike = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; let local_site = LocalSite::read(&mut conn).await?; diff --git a/crates/api/src/post/lock.rs b/crates/api/src/post/lock.rs index cea73318e..b163be7d3 100644 --- a/crates/api/src/post/lock.rs +++ b/crates/api/src/post/lock.rs @@ -27,7 +27,6 @@ impl Perform for LockPost { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &LockPost = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; diff --git a/crates/api/src/post/mark_read.rs b/crates/api/src/post/mark_read.rs index ba68881a8..076c76745 100644 --- a/crates/api/src/post/mark_read.rs +++ b/crates/api/src/post/mark_read.rs @@ -15,7 +15,6 @@ impl Perform for MarkPostAsRead { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; diff --git a/crates/api/src/post/save.rs b/crates/api/src/post/save.rs index 307f4e9ff..53d9de66a 100644 --- a/crates/api/src/post/save.rs +++ b/crates/api/src/post/save.rs @@ -19,7 +19,6 @@ impl Perform for SavePost { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &SavePost = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; diff --git a/crates/api/src/post_report/create.rs b/crates/api/src/post_report/create.rs index d81cf412e..400a4f325 100644 --- a/crates/api/src/post_report/create.rs +++ b/crates/api/src/post_report/create.rs @@ -23,7 +23,6 @@ impl Perform for CreatePostReport { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &CreatePostReport = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; let local_site = LocalSite::read(&mut conn).await?; diff --git a/crates/api/src/post_report/list.rs b/crates/api/src/post_report/list.rs index 1b13d5f27..3a8688075 100644 --- a/crates/api/src/post_report/list.rs +++ b/crates/api/src/post_report/list.rs @@ -30,7 +30,6 @@ impl Perform for ListPostReports { let page = data.page; let limit = data.limit; let mut conn = context.conn().await?; - let post_reports = PostReportQuery::builder() .conn(&mut conn) .my_person_id(person_id) diff --git a/crates/api/src/post_report/resolve.rs b/crates/api/src/post_report/resolve.rs index c2cdccd94..62c649a1a 100644 --- a/crates/api/src/post_report/resolve.rs +++ b/crates/api/src/post_report/resolve.rs @@ -17,7 +17,6 @@ impl Perform for ResolvePostReport { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &ResolvePostReport = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; diff --git a/crates/api/src/private_message/mark_read.rs b/crates/api/src/private_message/mark_read.rs index bb3dd70c1..893fca0d2 100644 --- a/crates/api/src/private_message/mark_read.rs +++ b/crates/api/src/private_message/mark_read.rs @@ -22,7 +22,6 @@ impl Perform for MarkPrivateMessageAsRead { context: &Data, ) -> Result { let mut conn = context.conn().await?; - let data: &MarkPrivateMessageAsRead = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; diff --git a/crates/api/src/private_message_report/create.rs b/crates/api/src/private_message_report/create.rs index 56d36ea09..6305aa649 100644 --- a/crates/api/src/private_message_report/create.rs +++ b/crates/api/src/private_message_report/create.rs @@ -23,7 +23,6 @@ impl Perform for CreatePrivateMessageReport { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let local_user_view = local_user_view_from_jwt(&self.auth, context).await?; let local_site = LocalSite::read(&mut conn).await?; diff --git a/crates/api/src/private_message_report/list.rs b/crates/api/src/private_message_report/list.rs index a5ee76f85..16e358b40 100644 --- a/crates/api/src/private_message_report/list.rs +++ b/crates/api/src/private_message_report/list.rs @@ -22,7 +22,6 @@ impl Perform for ListPrivateMessageReports { let page = self.page; let limit = self.limit; let mut conn = context.conn().await?; - let private_message_reports = PrivateMessageReportQuery::builder() .conn(&mut conn) .unresolved_only(unresolved_only) diff --git a/crates/api/src/private_message_report/resolve.rs b/crates/api/src/private_message_report/resolve.rs index 4f461a366..0c8f5893d 100644 --- a/crates/api/src/private_message_report/resolve.rs +++ b/crates/api/src/private_message_report/resolve.rs @@ -16,7 +16,6 @@ impl Perform for ResolvePrivateMessageReport { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let local_user_view = local_user_view_from_jwt(&self.auth, context).await?; is_admin(&local_user_view)?; diff --git a/crates/api/src/site/federated_instances.rs b/crates/api/src/site/federated_instances.rs index 6c2c18c0e..08ba092e3 100644 --- a/crates/api/src/site/federated_instances.rs +++ b/crates/api/src/site/federated_instances.rs @@ -15,7 +15,6 @@ impl Perform for GetFederatedInstances { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let site_view = SiteView::read_local(&mut conn).await?; let federated_instances = build_federated_instances(&site_view.local_site, context.pool()).await?; diff --git a/crates/api/src/site/leave_admin.rs b/crates/api/src/site/leave_admin.rs index 8a62ccf04..eb611ac21 100644 --- a/crates/api/src/site/leave_admin.rs +++ b/crates/api/src/site/leave_admin.rs @@ -26,7 +26,6 @@ impl Perform for LeaveAdmin { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &LeaveAdmin = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; diff --git a/crates/api/src/site/mod_log.rs b/crates/api/src/site/mod_log.rs index 7f6dad5a6..bfa904f91 100644 --- a/crates/api/src/site/mod_log.rs +++ b/crates/api/src/site/mod_log.rs @@ -38,7 +38,6 @@ impl Perform for GetModlog { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &GetModlog = self; let local_user_view = local_user_view_from_jwt_opt(data.auth.as_ref(), context).await; diff --git a/crates/api/src/site/purge/comment.rs b/crates/api/src/site/purge/comment.rs index c619aa56b..50ee4f230 100644 --- a/crates/api/src/site/purge/comment.rs +++ b/crates/api/src/site/purge/comment.rs @@ -21,7 +21,6 @@ impl Perform for PurgeComment { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &Self = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; diff --git a/crates/api/src/site/purge/community.rs b/crates/api/src/site/purge/community.rs index 112751ab8..949482358 100644 --- a/crates/api/src/site/purge/community.rs +++ b/crates/api/src/site/purge/community.rs @@ -22,7 +22,6 @@ impl Perform for PurgeCommunity { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &Self = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; diff --git a/crates/api/src/site/purge/person.rs b/crates/api/src/site/purge/person.rs index 76c6b95da..885f4b1a3 100644 --- a/crates/api/src/site/purge/person.rs +++ b/crates/api/src/site/purge/person.rs @@ -22,7 +22,6 @@ impl Perform for PurgePerson { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &Self = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; diff --git a/crates/api/src/site/purge/post.rs b/crates/api/src/site/purge/post.rs index 5036d104d..740c7abc3 100644 --- a/crates/api/src/site/purge/post.rs +++ b/crates/api/src/site/purge/post.rs @@ -22,7 +22,6 @@ impl Perform for PurgePost { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &Self = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; diff --git a/crates/api/src/site/registration_applications/approve.rs b/crates/api/src/site/registration_applications/approve.rs index 95011cb54..3aeaea9ba 100644 --- a/crates/api/src/site/registration_applications/approve.rs +++ b/crates/api/src/site/registration_applications/approve.rs @@ -22,7 +22,6 @@ impl Perform for ApproveRegistrationApplication { async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; diff --git a/crates/api/src/site/registration_applications/list.rs b/crates/api/src/site/registration_applications/list.rs index cbbb92743..e5a25343e 100644 --- a/crates/api/src/site/registration_applications/list.rs +++ b/crates/api/src/site/registration_applications/list.rs @@ -16,7 +16,6 @@ impl Perform for ListRegistrationApplications { async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; let local_site = LocalSite::read(&mut conn).await?; @@ -30,7 +29,6 @@ impl Perform for ListRegistrationApplications { let page = data.page; let limit = data.limit; let mut conn = context.conn().await?; - let registration_applications = RegistrationApplicationQuery::builder() .conn(&mut conn) .unread_only(unread_only) diff --git a/crates/api/src/site/registration_applications/unread_count.rs b/crates/api/src/site/registration_applications/unread_count.rs index 68b95e52d..981dc2604 100644 --- a/crates/api/src/site/registration_applications/unread_count.rs +++ b/crates/api/src/site/registration_applications/unread_count.rs @@ -15,7 +15,6 @@ impl Perform for GetUnreadRegistrationApplicationCount { async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; let local_site = LocalSite::read(&mut conn).await?; diff --git a/crates/api_common/src/utils.rs b/crates/api_common/src/utils.rs index 3ce2fd4af..29f307922 100644 --- a/crates/api_common/src/utils.rs +++ b/crates/api_common/src/utils.rs @@ -139,7 +139,6 @@ pub async fn local_user_view_from_jwt( context: &LemmyContext, ) -> Result { let mut conn = context.conn().await?; - let claims = Claims::decode(jwt, &context.secret().jwt_secret) .map_err(|e| e.with_message("not_logged_in"))? .claims; diff --git a/crates/api_crud/src/comment/create.rs b/crates/api_crud/src/comment/create.rs index b0c3ef970..5bb1e244c 100644 --- a/crates/api_crud/src/comment/create.rs +++ b/crates/api_crud/src/comment/create.rs @@ -42,7 +42,6 @@ impl PerformCrud for CreateComment { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &CreateComment = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; let local_site = LocalSite::read(&mut conn).await?; diff --git a/crates/api_crud/src/comment/delete.rs b/crates/api_crud/src/comment/delete.rs index 13fc39af2..5115cb593 100644 --- a/crates/api_crud/src/comment/delete.rs +++ b/crates/api_crud/src/comment/delete.rs @@ -23,7 +23,6 @@ impl PerformCrud for DeleteComment { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &DeleteComment = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; diff --git a/crates/api_crud/src/comment/read.rs b/crates/api_crud/src/comment/read.rs index e974ba5c7..210b74b0a 100644 --- a/crates/api_crud/src/comment/read.rs +++ b/crates/api_crud/src/comment/read.rs @@ -16,7 +16,6 @@ impl PerformCrud for GetComment { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data = self; let local_user_view = local_user_view_from_jwt_opt(data.auth.as_ref(), context).await; let local_site = LocalSite::read(&mut conn).await?; diff --git a/crates/api_crud/src/comment/remove.rs b/crates/api_crud/src/comment/remove.rs index b0964832f..56719922a 100644 --- a/crates/api_crud/src/comment/remove.rs +++ b/crates/api_crud/src/comment/remove.rs @@ -24,7 +24,6 @@ impl PerformCrud for RemoveComment { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &RemoveComment = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; diff --git a/crates/api_crud/src/comment/update.rs b/crates/api_crud/src/comment/update.rs index e9ee195c2..6db62295b 100644 --- a/crates/api_crud/src/comment/update.rs +++ b/crates/api_crud/src/comment/update.rs @@ -32,7 +32,6 @@ impl PerformCrud for EditComment { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &EditComment = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; let local_site = LocalSite::read(&mut conn).await?; diff --git a/crates/api_crud/src/community/create.rs b/crates/api_crud/src/community/create.rs index 89ee06dec..f9e2b9c3c 100644 --- a/crates/api_crud/src/community/create.rs +++ b/crates/api_crud/src/community/create.rs @@ -47,7 +47,6 @@ impl PerformCrud for CreateCommunity { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &CreateCommunity = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; let site_view = SiteView::read_local(&mut conn).await?; diff --git a/crates/api_crud/src/community/delete.rs b/crates/api_crud/src/community/delete.rs index 414d52384..84e555de6 100644 --- a/crates/api_crud/src/community/delete.rs +++ b/crates/api_crud/src/community/delete.rs @@ -20,7 +20,6 @@ impl PerformCrud for DeleteCommunity { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &DeleteCommunity = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; diff --git a/crates/api_crud/src/community/list.rs b/crates/api_crud/src/community/list.rs index 0727f4cf2..d00db436b 100644 --- a/crates/api_crud/src/community/list.rs +++ b/crates/api_crud/src/community/list.rs @@ -19,7 +19,6 @@ impl PerformCrud for ListCommunities { context: &Data, ) -> Result { let mut conn = context.conn().await?; - let data: &ListCommunities = self; let local_user_view = local_user_view_from_jwt_opt(data.auth.as_ref(), context).await; let local_site = LocalSite::read(&mut conn).await?; @@ -34,7 +33,6 @@ impl PerformCrud for ListCommunities { let limit = data.limit; let local_user = local_user_view.map(|l| l.local_user); let mut conn = context.conn().await?; - let communities = CommunityQuery::builder() .conn(&mut conn) .listing_type(listing_type) diff --git a/crates/api_crud/src/community/remove.rs b/crates/api_crud/src/community/remove.rs index 4f94897e2..d3c7cae46 100644 --- a/crates/api_crud/src/community/remove.rs +++ b/crates/api_crud/src/community/remove.rs @@ -22,7 +22,6 @@ impl PerformCrud for RemoveCommunity { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &RemoveCommunity = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; diff --git a/crates/api_crud/src/community/update.rs b/crates/api_crud/src/community/update.rs index 8e01e1418..9cd60c05a 100644 --- a/crates/api_crud/src/community/update.rs +++ b/crates/api_crud/src/community/update.rs @@ -29,7 +29,6 @@ impl PerformCrud for EditCommunity { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &EditCommunity = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; let local_site = LocalSite::read(&mut conn).await?; diff --git a/crates/api_crud/src/custom_emoji/create.rs b/crates/api_crud/src/custom_emoji/create.rs index d1b8547e9..8df6be0b6 100644 --- a/crates/api_crud/src/custom_emoji/create.rs +++ b/crates/api_crud/src/custom_emoji/create.rs @@ -20,7 +20,6 @@ impl PerformCrud for CreateCustomEmoji { #[tracing::instrument(skip(self, context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &CreateCustomEmoji = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; diff --git a/crates/api_crud/src/custom_emoji/delete.rs b/crates/api_crud/src/custom_emoji/delete.rs index c2021c0db..ac9752f68 100644 --- a/crates/api_crud/src/custom_emoji/delete.rs +++ b/crates/api_crud/src/custom_emoji/delete.rs @@ -18,7 +18,6 @@ impl PerformCrud for DeleteCustomEmoji { context: &Data, ) -> Result { let mut conn = context.conn().await?; - let data: &DeleteCustomEmoji = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; diff --git a/crates/api_crud/src/custom_emoji/update.rs b/crates/api_crud/src/custom_emoji/update.rs index ddc3ae2fb..1d0e6416d 100644 --- a/crates/api_crud/src/custom_emoji/update.rs +++ b/crates/api_crud/src/custom_emoji/update.rs @@ -20,7 +20,6 @@ impl PerformCrud for EditCustomEmoji { #[tracing::instrument(skip(self, context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &EditCustomEmoji = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; diff --git a/crates/api_crud/src/post/create.rs b/crates/api_crud/src/post/create.rs index 75f1cf787..a7b5bdd82 100644 --- a/crates/api_crud/src/post/create.rs +++ b/crates/api_crud/src/post/create.rs @@ -45,7 +45,6 @@ impl PerformCrud for CreatePost { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &CreatePost = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; let local_site = LocalSite::read(&mut conn).await?; diff --git a/crates/api_crud/src/post/delete.rs b/crates/api_crud/src/post/delete.rs index 6a1117502..1206023de 100644 --- a/crates/api_crud/src/post/delete.rs +++ b/crates/api_crud/src/post/delete.rs @@ -19,7 +19,6 @@ impl PerformCrud for DeletePost { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &DeletePost = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; diff --git a/crates/api_crud/src/post/read.rs b/crates/api_crud/src/post/read.rs index f96973838..d746dbd61 100644 --- a/crates/api_crud/src/post/read.rs +++ b/crates/api_crud/src/post/read.rs @@ -26,7 +26,6 @@ impl PerformCrud for GetPost { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &GetPost = self; let local_user_view = local_user_view_from_jwt_opt(data.auth.as_ref(), context).await; let local_site = LocalSite::read(&mut conn).await?; diff --git a/crates/api_crud/src/post/remove.rs b/crates/api_crud/src/post/remove.rs index 71a9886ab..d4cb193c4 100644 --- a/crates/api_crud/src/post/remove.rs +++ b/crates/api_crud/src/post/remove.rs @@ -22,7 +22,6 @@ impl PerformCrud for RemovePost { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &RemovePost = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; diff --git a/crates/api_crud/src/post/update.rs b/crates/api_crud/src/post/update.rs index 053f7f936..ad25e881e 100644 --- a/crates/api_crud/src/post/update.rs +++ b/crates/api_crud/src/post/update.rs @@ -31,7 +31,6 @@ impl PerformCrud for EditPost { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &EditPost = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; let local_site = LocalSite::read(&mut conn).await?; diff --git a/crates/api_crud/src/private_message/create.rs b/crates/api_crud/src/private_message/create.rs index 6f35a0ca2..ca41b65b6 100644 --- a/crates/api_crud/src/private_message/create.rs +++ b/crates/api_crud/src/private_message/create.rs @@ -36,7 +36,6 @@ impl PerformCrud for CreatePrivateMessage { context: &Data, ) -> Result { let mut conn = context.conn().await?; - let data: &CreatePrivateMessage = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; let local_site = LocalSite::read(&mut conn).await?; diff --git a/crates/api_crud/src/private_message/delete.rs b/crates/api_crud/src/private_message/delete.rs index b167d1d43..35e4b2158 100644 --- a/crates/api_crud/src/private_message/delete.rs +++ b/crates/api_crud/src/private_message/delete.rs @@ -22,7 +22,6 @@ impl PerformCrud for DeletePrivateMessage { context: &Data, ) -> Result { let mut conn = context.conn().await?; - let data: &DeletePrivateMessage = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; diff --git a/crates/api_crud/src/private_message/read.rs b/crates/api_crud/src/private_message/read.rs index d6ef0afb1..ddd3e83a1 100644 --- a/crates/api_crud/src/private_message/read.rs +++ b/crates/api_crud/src/private_message/read.rs @@ -18,7 +18,6 @@ impl PerformCrud for GetPrivateMessages { context: &Data, ) -> Result { let mut conn = context.conn().await?; - let data: &GetPrivateMessages = self; let local_user_view = local_user_view_from_jwt(data.auth.as_ref(), context).await?; let person_id = local_user_view.person.id; diff --git a/crates/api_crud/src/private_message/update.rs b/crates/api_crud/src/private_message/update.rs index 497c176ff..064c33bc9 100644 --- a/crates/api_crud/src/private_message/update.rs +++ b/crates/api_crud/src/private_message/update.rs @@ -29,7 +29,6 @@ impl PerformCrud for EditPrivateMessage { context: &Data, ) -> Result { let mut conn = context.conn().await?; - let data: &EditPrivateMessage = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; let local_site = LocalSite::read(&mut conn).await?; diff --git a/crates/api_crud/src/site/create.rs b/crates/api_crud/src/site/create.rs index 5d840ceda..ed5c86067 100644 --- a/crates/api_crud/src/site/create.rs +++ b/crates/api_crud/src/site/create.rs @@ -48,7 +48,6 @@ impl PerformCrud for CreateSite { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &CreateSite = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; diff --git a/crates/api_crud/src/site/read.rs b/crates/api_crud/src/site/read.rs index eff53a344..835b569e6 100644 --- a/crates/api_crud/src/site/read.rs +++ b/crates/api_crud/src/site/read.rs @@ -31,7 +31,6 @@ impl PerformCrud for GetSite { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &GetSite = self; let site_view = SiteView::read_local(&mut conn).await?; diff --git a/crates/api_crud/src/site/update.rs b/crates/api_crud/src/site/update.rs index 1a16c2320..377e38cd3 100644 --- a/crates/api_crud/src/site/update.rs +++ b/crates/api_crud/src/site/update.rs @@ -45,7 +45,6 @@ impl PerformCrud for EditSite { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &EditSite = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; let site_view = SiteView::read_local(&mut conn).await?; diff --git a/crates/api_crud/src/user/create.rs b/crates/api_crud/src/user/create.rs index ddf4855c1..ab00149d4 100644 --- a/crates/api_crud/src/user/create.rs +++ b/crates/api_crud/src/user/create.rs @@ -44,7 +44,6 @@ impl PerformCrud for Register { #[tracing::instrument(skip(self, context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &Register = self; let site_view = SiteView::read_local(&mut conn).await?; diff --git a/crates/apub/src/activities/block/block_user.rs b/crates/apub/src/activities/block/block_user.rs index 5714d9676..3064ab85c 100644 --- a/crates/apub/src/activities/block/block_user.rs +++ b/crates/apub/src/activities/block/block_user.rs @@ -152,7 +152,6 @@ impl ActivityHandler for BlockUser { #[tracing::instrument(skip_all)] async fn receive(self, context: &Data) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - insert_activity(&self.id, &self, false, false, context).await?; let expires = self.expires.map(|u| u.naive_local()); let mod_person = self.actor.dereference(context).await?; diff --git a/crates/apub/src/activities/block/mod.rs b/crates/apub/src/activities/block/mod.rs index 2639ff05d..be03751a6 100644 --- a/crates/apub/src/activities/block/mod.rs +++ b/crates/apub/src/activities/block/mod.rs @@ -139,7 +139,6 @@ impl SendActivity for BanPerson { context: &Data, ) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - let local_user_view = local_user_view_from_jwt(&request.auth, context).await?; let person = Person::read(&mut conn, request.person_id).await?; let site = SiteOrCommunity::Site(SiteView::read_local(&mut conn).await?.site.into()); @@ -184,7 +183,6 @@ impl SendActivity for BanFromCommunity { context: &Data, ) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - let local_user_view = local_user_view_from_jwt(&request.auth, context).await?; let community: ApubCommunity = Community::read(&mut conn, request.community_id) .await? diff --git a/crates/apub/src/activities/block/undo_block_user.rs b/crates/apub/src/activities/block/undo_block_user.rs index 1dac5a0da..a5a6f98e9 100644 --- a/crates/apub/src/activities/block/undo_block_user.rs +++ b/crates/apub/src/activities/block/undo_block_user.rs @@ -39,7 +39,6 @@ impl UndoBlockUser { context: &Data, ) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - let block = BlockUser::new(target, user, mod_, None, reason, None, context).await?; let audience = if let SiteOrCommunity::Community(c) = target { Some(c.id().into()) @@ -99,7 +98,6 @@ impl ActivityHandler for UndoBlockUser { #[tracing::instrument(skip_all)] async fn receive(self, context: &Data) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - insert_activity(&self.id, &self, false, false, context).await?; let expires = self.object.expires.map(|u| u.naive_local()); let mod_person = self.actor.dereference(context).await?; diff --git a/crates/apub/src/activities/community/collection_add.rs b/crates/apub/src/activities/community/collection_add.rs index e6dcc6724..858ffff0c 100644 --- a/crates/apub/src/activities/community/collection_add.rs +++ b/crates/apub/src/activities/community/collection_add.rs @@ -118,7 +118,6 @@ impl ActivityHandler for CollectionAdd { #[tracing::instrument(skip_all)] async fn receive(self, context: &Data) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - insert_activity(&self.id, &self, false, false, context).await?; let (community, collection_type) = Community::get_by_collection_url(&mut conn, &self.target.into()).await?; @@ -176,7 +175,6 @@ impl SendActivity for AddModToCommunity { context: &Data, ) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - let local_user_view = local_user_view_from_jwt(&request.auth, context).await?; let community: ApubCommunity = Community::read(&mut conn, request.community_id) .await? @@ -212,7 +210,6 @@ impl SendActivity for FeaturePost { context: &Data, ) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - let local_user_view = local_user_view_from_jwt(&request.auth, context).await?; let community = Community::read(&mut conn, response.post_view.community.id) .await? diff --git a/crates/apub/src/activities/community/collection_remove.rs b/crates/apub/src/activities/community/collection_remove.rs index 8fdbfd727..9502db7c8 100644 --- a/crates/apub/src/activities/community/collection_remove.rs +++ b/crates/apub/src/activities/community/collection_remove.rs @@ -111,7 +111,6 @@ impl ActivityHandler for CollectionRemove { #[tracing::instrument(skip_all)] async fn receive(self, context: &Data) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - insert_activity(&self.id, &self, false, false, context).await?; let (community, collection_type) = Community::get_by_collection_url(&mut conn, &self.target.into()).await?; diff --git a/crates/apub/src/activities/community/lock_page.rs b/crates/apub/src/activities/community/lock_page.rs index 7c542cc3c..2e7c1839e 100644 --- a/crates/apub/src/activities/community/lock_page.rs +++ b/crates/apub/src/activities/community/lock_page.rs @@ -59,7 +59,6 @@ impl ActivityHandler for LockPage { async fn receive(self, context: &Data) -> Result<(), Self::Error> { let mut conn = context.conn().await?; - let form = PostUpdateForm::builder().locked(Some(true)).build(); let post = self.object.dereference(context).await?; Post::update(&mut conn, post.id, &form).await?; @@ -97,7 +96,6 @@ impl ActivityHandler for UndoLockPage { async fn receive(self, context: &Data) -> Result<(), Self::Error> { let mut conn = context.conn().await?; - insert_activity(&self.id, &self, false, false, context).await?; let form = PostUpdateForm::builder().locked(Some(false)).build(); let post = self.object.object.dereference(context).await?; @@ -116,7 +114,6 @@ impl SendActivity for LockPost { context: &Data, ) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - let local_user_view = local_user_view_from_jwt(&request.auth, context).await?; let id = generate_activity_id( LockType::Lock, diff --git a/crates/apub/src/activities/community/mod.rs b/crates/apub/src/activities/community/mod.rs index e92e64d02..fa48b99e4 100644 --- a/crates/apub/src/activities/community/mod.rs +++ b/crates/apub/src/activities/community/mod.rs @@ -38,8 +38,7 @@ pub(crate) async fn send_activity_in_community( is_mod_action: bool, context: &Data, ) -> Result<(), LemmyError> { - let mut conn = context.conn().await?; - // send to any users which are mentioned or affected directly + let mut conn = context.conn().await?; // send to any users which are mentioned or affected directly let mut inboxes = extra_inboxes; // send to user followers diff --git a/crates/apub/src/activities/community/report.rs b/crates/apub/src/activities/community/report.rs index 91bc33c85..3babbfa26 100644 --- a/crates/apub/src/activities/community/report.rs +++ b/crates/apub/src/activities/community/report.rs @@ -123,7 +123,6 @@ impl ActivityHandler for Report { #[tracing::instrument(skip_all)] async fn receive(self, context: &Data) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - insert_activity(&self.id, &self, false, true, context).await?; let actor = self.actor.dereference(context).await?; match self.object.dereference(context).await? { diff --git a/crates/apub/src/activities/community/update.rs b/crates/apub/src/activities/community/update.rs index 5b76e9deb..7f32dd55c 100644 --- a/crates/apub/src/activities/community/update.rs +++ b/crates/apub/src/activities/community/update.rs @@ -36,7 +36,6 @@ impl SendActivity for EditCommunity { context: &Data, ) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - let local_user_view = local_user_view_from_jwt(&request.auth, context).await?; let community = Community::read(&mut conn, request.community_id).await?; UpdateCommunity::send(community.into(), &local_user_view.person.into(), context).await @@ -95,7 +94,6 @@ impl ActivityHandler for UpdateCommunity { #[tracing::instrument(skip_all)] async fn receive(self, context: &Data) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - insert_activity(&self.id, &self, false, false, context).await?; let community = self.community(context).await?; @@ -116,7 +114,6 @@ impl SendActivity for HideCommunity { context: &Data, ) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - let local_user_view = local_user_view_from_jwt(&request.auth, context).await?; let community = Community::read(&mut conn, request.community_id).await?; UpdateCommunity::send(community.into(), &local_user_view.person.into(), context).await diff --git a/crates/apub/src/activities/create_or_update/comment.rs b/crates/apub/src/activities/create_or_update/comment.rs index 923fd5edf..da32eee28 100644 --- a/crates/apub/src/activities/create_or_update/comment.rs +++ b/crates/apub/src/activities/create_or_update/comment.rs @@ -89,8 +89,7 @@ impl CreateOrUpdateNote { kind: CreateOrUpdateType, context: &Data, ) -> Result<(), LemmyError> { - let mut conn = context.conn().await?; - // TODO: might be helpful to add a comment method to retrieve community directly + let mut conn = context.conn().await?; // TODO: might be helpful to add a comment method to retrieve community directly let post_id = comment.post_id; let post = Post::read(&mut conn, post_id).await?; let community_id = post.community_id; @@ -169,7 +168,6 @@ impl ActivityHandler for CreateOrUpdateNote { #[tracing::instrument(skip_all)] async fn receive(self, context: &Data) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - insert_activity(&self.id, &self, false, false, context).await?; // Need to do this check here instead of Note::from_json because we need the person who // send the activity, not the comment author. diff --git a/crates/apub/src/activities/create_or_update/post.rs b/crates/apub/src/activities/create_or_update/post.rs index 5fdf723be..a43788288 100644 --- a/crates/apub/src/activities/create_or_update/post.rs +++ b/crates/apub/src/activities/create_or_update/post.rs @@ -108,7 +108,6 @@ impl CreateOrUpdatePage { context: &Data, ) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - let post = ApubPost(post.clone()); let community_id = post.community_id; let person: ApubPerson = Person::read(&mut conn, person_id).await?.into(); @@ -181,7 +180,6 @@ impl ActivityHandler for CreateOrUpdatePage { #[tracing::instrument(skip_all)] async fn receive(self, context: &Data) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - insert_activity(&self.id, &self, false, false, context).await?; let post = ApubPost::from_json(self.object, context).await?; 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 0f29e9cc9..c34c68995 100644 --- a/crates/apub/src/activities/create_or_update/private_message.rs +++ b/crates/apub/src/activities/create_or_update/private_message.rs @@ -71,7 +71,6 @@ impl CreateOrUpdateChatMessage { context: &Data, ) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - let recipient_id = private_message.recipient_id; let sender: ApubPerson = Person::read(&mut conn, sender_id).await?.into(); let recipient: ApubPerson = Person::read(&mut conn, recipient_id).await?.into(); diff --git a/crates/apub/src/activities/deletion/delete.rs b/crates/apub/src/activities/deletion/delete.rs index 6e111df10..692d1d6c5 100644 --- a/crates/apub/src/activities/deletion/delete.rs +++ b/crates/apub/src/activities/deletion/delete.rs @@ -106,7 +106,6 @@ pub(in crate::activities) async fn receive_remove_action( context: &Data, ) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - match DeletableObjects::read_from_db(object, context).await? { DeletableObjects::Community(community) => { if community.local { diff --git a/crates/apub/src/activities/deletion/delete_user.rs b/crates/apub/src/activities/deletion/delete_user.rs index bd1d64588..da31bc4bc 100644 --- a/crates/apub/src/activities/deletion/delete_user.rs +++ b/crates/apub/src/activities/deletion/delete_user.rs @@ -29,7 +29,6 @@ impl SendActivity for DeleteAccount { context: &Data, ) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - let local_user_view = local_user_view_from_jwt(&request.auth, context).await?; let actor: ApubPerson = local_user_view.person.into(); delete_user_account(actor.id, &mut conn, context.settings(), context.client()).await?; @@ -77,7 +76,6 @@ impl ActivityHandler for DeleteUser { async fn receive(self, context: &Data) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - insert_activity(&self.id, &self, false, false, context).await?; let actor = self.actor.dereference(context).await?; delete_user_account(actor.id, &mut conn, context.settings(), context.client()).await?; diff --git a/crates/apub/src/activities/deletion/mod.rs b/crates/apub/src/activities/deletion/mod.rs index 7de13e247..7fdcefd35 100644 --- a/crates/apub/src/activities/deletion/mod.rs +++ b/crates/apub/src/activities/deletion/mod.rs @@ -64,7 +64,6 @@ impl SendActivity for DeletePost { context: &Data, ) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - let local_user_view = local_user_view_from_jwt(&request.auth, context).await?; let community = Community::read(&mut conn, response.post_view.community.id).await?; let deletable = DeletableObjects::Post(response.post_view.post.clone().into()); @@ -90,7 +89,6 @@ impl SendActivity for RemovePost { context: &Data, ) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - let local_user_view = local_user_view_from_jwt(&request.auth, context).await?; let community = Community::read(&mut conn, response.post_view.community.id).await?; let deletable = DeletableObjects::Post(response.post_view.post.clone().into()); @@ -116,7 +114,6 @@ impl SendActivity for DeleteComment { context: &Data, ) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - let community_id = response.comment_view.community.id; let community = Community::read(&mut conn, community_id).await?; let person = Person::read(&mut conn, response.comment_view.creator.id).await?; @@ -136,7 +133,6 @@ impl SendActivity for RemoveComment { context: &Data, ) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - let local_user_view = local_user_view_from_jwt(&request.auth, context).await?; let comment = Comment::read(&mut conn, request.comment_id).await?; let community = Community::read(&mut conn, response.comment_view.community.id).await?; @@ -183,7 +179,6 @@ impl SendActivity for DeleteCommunity { context: &Data, ) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - let local_user_view = local_user_view_from_jwt(&request.auth, context).await?; let community = Community::read(&mut conn, request.community_id).await?; let deletable = DeletableObjects::Community(community.clone().into()); @@ -209,7 +204,6 @@ impl SendActivity for RemoveCommunity { context: &Data, ) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - let local_user_view = local_user_view_from_jwt(&request.auth, context).await?; let community = Community::read(&mut conn, request.community_id).await?; let deletable = DeletableObjects::Community(community.clone().into()); @@ -264,7 +258,6 @@ async fn send_apub_delete_private_message( context: &Data, ) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - let recipient_id = pm.recipient_id; let recipient: ApubPerson = Person::read(&mut conn, recipient_id).await?.into(); @@ -393,7 +386,6 @@ async fn receive_delete_action( context: &Data, ) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - match DeletableObjects::read_from_db(object, context).await? { DeletableObjects::Community(community) => { if community.local { diff --git a/crates/apub/src/activities/deletion/undo_delete.rs b/crates/apub/src/activities/deletion/undo_delete.rs index 399b8a66e..654d578a1 100644 --- a/crates/apub/src/activities/deletion/undo_delete.rs +++ b/crates/apub/src/activities/deletion/undo_delete.rs @@ -98,7 +98,6 @@ impl UndoDelete { context: &Data, ) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - match DeletableObjects::read_from_db(object, context).await? { DeletableObjects::Community(community) => { if community.local { diff --git a/crates/apub/src/activities/following/accept.rs b/crates/apub/src/activities/following/accept.rs index 1a9ea8cec..dd1c93e3d 100644 --- a/crates/apub/src/activities/following/accept.rs +++ b/crates/apub/src/activities/following/accept.rs @@ -61,7 +61,6 @@ impl ActivityHandler for AcceptFollow { #[tracing::instrument(skip_all)] async fn receive(self, context: &Data) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - insert_activity(&self.id, &self, false, true, context).await?; let community = self.actor.dereference(context).await?; let person = self.object.actor.dereference(context).await?; diff --git a/crates/apub/src/activities/following/follow.rs b/crates/apub/src/activities/following/follow.rs index 5ce2b7502..8b860e2ca 100644 --- a/crates/apub/src/activities/following/follow.rs +++ b/crates/apub/src/activities/following/follow.rs @@ -61,7 +61,6 @@ impl Follow { context: &Data, ) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - let community_follower_form = CommunityFollowerForm { community_id: community.id, person_id: actor.id, @@ -106,7 +105,6 @@ impl ActivityHandler for Follow { #[tracing::instrument(skip_all)] async fn receive(self, context: &Data) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - insert_activity(&self.id, &self, false, true, context).await?; let actor = self.actor.dereference(context).await?; let object = self.object.dereference(context).await?; @@ -143,7 +141,6 @@ impl SendActivity for BlockCommunity { context: &Data, ) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - let local_user_view = local_user_view_from_jwt(&request.auth, context).await?; let community = Community::read(&mut conn, request.community_id).await?; UndoFollow::send(&local_user_view.person.into(), &community.into(), context).await diff --git a/crates/apub/src/activities/following/mod.rs b/crates/apub/src/activities/following/mod.rs index 862231bae..b0c88d71a 100644 --- a/crates/apub/src/activities/following/mod.rs +++ b/crates/apub/src/activities/following/mod.rs @@ -26,7 +26,6 @@ impl SendActivity for FollowCommunity { context: &Data, ) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - let local_user_view = local_user_view_from_jwt(&request.auth, context).await?; let person = local_user_view.person.clone().into(); let community: ApubCommunity = Community::read(&mut conn, request.community_id) diff --git a/crates/apub/src/activities/following/undo_follow.rs b/crates/apub/src/activities/following/undo_follow.rs index 8d6acabc2..737ae7cfe 100644 --- a/crates/apub/src/activities/following/undo_follow.rs +++ b/crates/apub/src/activities/following/undo_follow.rs @@ -72,7 +72,6 @@ impl ActivityHandler for UndoFollow { #[tracing::instrument(skip_all)] async fn receive(self, context: &Data) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - insert_activity(&self.id, &self, false, true, context).await?; let person = self.actor.dereference(context).await?; let object = self.object.object.dereference(context).await?; diff --git a/crates/apub/src/activities/mod.rs b/crates/apub/src/activities/mod.rs index 0c70da8d6..c7cf27ce7 100644 --- a/crates/apub/src/activities/mod.rs +++ b/crates/apub/src/activities/mod.rs @@ -54,7 +54,6 @@ pub(crate) async fn verify_person_in_community( context: &Data, ) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - let person = person_id.dereference(context).await?; if person.banned { return Err(LemmyError::from_message("Person is banned from site")); @@ -84,7 +83,6 @@ pub(crate) async fn verify_mod_action( context: &Data, ) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - let mod_ = mod_id.dereference(context).await?; let is_mod_or_admin = CommunityView::is_mod_or_admin(&mut conn, mod_.id, community_id).await?; diff --git a/crates/apub/src/activities/voting/mod.rs b/crates/apub/src/activities/voting/mod.rs index 6e679e572..0a09c034e 100644 --- a/crates/apub/src/activities/voting/mod.rs +++ b/crates/apub/src/activities/voting/mod.rs @@ -84,7 +84,6 @@ async fn send_activity( context: &Data, ) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - let community = Community::read(&mut conn, community_id).await?.into(); let local_user_view = local_user_view_from_jwt(jwt, context).await?; let actor = Person::read(&mut conn, local_user_view.person.id) @@ -113,7 +112,6 @@ async fn vote_comment( context: &Data, ) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - let comment_id = comment.id; let like_form = CommentLikeForm { comment_id, @@ -135,7 +133,6 @@ async fn vote_post( context: &Data, ) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - let post_id = post.id; let like_form = PostLikeForm { post_id: post.id, @@ -155,7 +152,6 @@ async fn undo_vote_comment( context: &Data, ) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - let comment_id = comment.id; let person_id = actor.id; CommentLike::remove(&mut conn, person_id, comment_id).await?; @@ -169,7 +165,6 @@ async fn undo_vote_post( context: &Data, ) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - let post_id = post.id; let person_id = actor.id; PostLike::remove(&mut conn, person_id, post_id).await?; diff --git a/crates/apub/src/api/list_comments.rs b/crates/apub/src/api/list_comments.rs index 6738b9c22..e68cedb0c 100644 --- a/crates/apub/src/api/list_comments.rs +++ b/crates/apub/src/api/list_comments.rs @@ -23,7 +23,6 @@ impl PerformApub for GetComments { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &GetComments = self; let local_user_view = local_user_view_from_jwt_opt(data.auth.as_ref(), context).await; let local_site = LocalSite::read(&mut conn).await?; @@ -57,7 +56,6 @@ impl PerformApub for GetComments { let post_id = data.post_id; let local_user = local_user_view.map(|l| l.local_user); let mut conn = context.conn().await?; - let comments = CommentQuery::builder() .conn(&mut conn) .listing_type(Some(listing_type)) diff --git a/crates/apub/src/api/list_posts.rs b/crates/apub/src/api/list_posts.rs index 38776c00b..cdd8a4b96 100644 --- a/crates/apub/src/api/list_posts.rs +++ b/crates/apub/src/api/list_posts.rs @@ -20,7 +20,6 @@ impl PerformApub for GetPosts { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &GetPosts = self; let local_user_view = local_user_view_from_jwt_opt(data.auth.as_ref(), context).await; let local_site = LocalSite::read(&mut conn).await?; @@ -48,7 +47,6 @@ impl PerformApub for GetPosts { .is_ok(); let mut conn = context.conn().await?; - let posts = PostQuery::builder() .conn(&mut conn) .local_user(local_user_view.map(|l| l.local_user).as_ref()) diff --git a/crates/apub/src/api/read_community.rs b/crates/apub/src/api/read_community.rs index 7b07a10a9..860eb72d3 100644 --- a/crates/apub/src/api/read_community.rs +++ b/crates/apub/src/api/read_community.rs @@ -28,7 +28,6 @@ impl PerformApub for GetCommunity { context: &Data, ) -> Result { let mut conn = context.conn().await?; - let data: &GetCommunity = self; let local_user_view = local_user_view_from_jwt_opt(data.auth.as_ref(), context).await; let local_site = LocalSite::read(&mut conn).await?; diff --git a/crates/apub/src/api/read_person.rs b/crates/apub/src/api/read_person.rs index 60d1e38dd..617b43eee 100644 --- a/crates/apub/src/api/read_person.rs +++ b/crates/apub/src/api/read_person.rs @@ -23,7 +23,6 @@ impl PerformApub for GetPersonDetails { context: &Data, ) -> Result { let mut conn = context.conn().await?; - let data: &GetPersonDetails = self; // Check to make sure a person name or an id is given @@ -66,7 +65,6 @@ impl PerformApub for GetPersonDetails { let local_user_clone = local_user.clone(); let mut conn = context.conn().await?; - let posts_query = PostQuery::builder() .conn(&mut conn) .sort(sort) @@ -90,7 +88,6 @@ impl PerformApub for GetPersonDetails { .await?; let mut conn = context.conn().await?; - let comments_query = CommentQuery::builder() .conn(&mut conn) .local_user(local_user_clone.as_ref()) diff --git a/crates/apub/src/api/resolve_object.rs b/crates/apub/src/api/resolve_object.rs index 801fa049f..48551ee37 100644 --- a/crates/apub/src/api/resolve_object.rs +++ b/crates/apub/src/api/resolve_object.rs @@ -24,7 +24,6 @@ impl PerformApub for ResolveObject { context: &Data, ) -> Result { let mut conn = context.conn().await?; - let local_user_view = local_user_view_from_jwt(&self.auth, context).await?; let local_site = LocalSite::read(&mut conn).await?; let person_id = local_user_view.person.id; diff --git a/crates/apub/src/api/search.rs b/crates/apub/src/api/search.rs index 57e09de42..01eb219c7 100644 --- a/crates/apub/src/api/search.rs +++ b/crates/apub/src/api/search.rs @@ -25,7 +25,6 @@ impl PerformApub for Search { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let data: &Search = self; let local_user_view = local_user_view_from_jwt_opt(data.auth.as_ref(), context).await; @@ -59,7 +58,6 @@ impl PerformApub for Search { let creator_id = data.creator_id; let local_user = local_user_view.map(|l| l.local_user); let mut conn = context.conn().await?; - match search_type { SearchType::Posts => { posts = PostQuery::builder() diff --git a/crates/apub/src/fetcher/mod.rs b/crates/apub/src/fetcher/mod.rs index d75272123..2a1e1dd49 100644 --- a/crates/apub/src/fetcher/mod.rs +++ b/crates/apub/src/fetcher/mod.rs @@ -35,8 +35,7 @@ where for<'de2> ::Kind: serde::Deserialize<'de2>, DbActor: ApubActor + Send + 'static, { - let mut conn = context.conn().await?; - // remote actor + let mut conn = context.conn().await?; // remote actor if identifier.contains('@') { let (name, domain) = identifier .splitn(2, '@') diff --git a/crates/apub/src/fetcher/post_or_comment.rs b/crates/apub/src/fetcher/post_or_comment.rs index 68f1aaa49..29651d488 100644 --- a/crates/apub/src/fetcher/post_or_comment.rs +++ b/crates/apub/src/fetcher/post_or_comment.rs @@ -90,7 +90,6 @@ impl Object for PostOrComment { impl InCommunity for PostOrComment { async fn community(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let cid = match self { PostOrComment::Post(p) => p.community_id, PostOrComment::Comment(c) => Post::read(&mut conn, c.post_id).await?.community_id, diff --git a/crates/apub/src/http/comment.rs b/crates/apub/src/http/comment.rs index d77f61822..ce497b95a 100644 --- a/crates/apub/src/http/comment.rs +++ b/crates/apub/src/http/comment.rs @@ -21,7 +21,6 @@ pub(crate) async fn get_apub_comment( context: Data, ) -> Result { let mut conn = context.conn().await?; - let id = CommentId(info.comment_id.parse::()?); let comment: ApubComment = Comment::read(&mut conn, id).await?.into(); if !comment.local { diff --git a/crates/apub/src/http/community.rs b/crates/apub/src/http/community.rs index 3051b8f1d..7d140332b 100644 --- a/crates/apub/src/http/community.rs +++ b/crates/apub/src/http/community.rs @@ -33,7 +33,6 @@ pub(crate) async fn get_apub_community_http( context: Data, ) -> Result { let mut conn = context.conn().await?; - let community: ApubCommunity = Community::read_from_name(&mut conn, &info.community_name, true) .await? .into(); @@ -66,7 +65,6 @@ pub(crate) async fn get_apub_community_followers( context: Data, ) -> Result { let mut conn = context.conn().await?; - let community = Community::read_from_name(&mut conn, &info.community_name, false).await?; let followers = GroupFollowers::new(community, &context).await?; create_apub_response(&followers) @@ -79,7 +77,6 @@ pub(crate) async fn get_apub_community_outbox( context: Data, ) -> Result { let mut conn = context.conn().await?; - let community: ApubCommunity = Community::read_from_name(&mut conn, &info.community_name, false) .await? .into(); @@ -96,7 +93,6 @@ pub(crate) async fn get_apub_community_moderators( context: Data, ) -> Result { let mut conn = context.conn().await?; - let community: ApubCommunity = Community::read_from_name(&mut conn, &info.community_name, false) .await? .into(); @@ -113,7 +109,6 @@ pub(crate) async fn get_apub_community_featured( context: Data, ) -> Result { let mut conn = context.conn().await?; - let community: ApubCommunity = Community::read_from_name(&mut conn, &info.community_name, false) .await? .into(); diff --git a/crates/apub/src/http/mod.rs b/crates/apub/src/http/mod.rs index a4c2d0dcd..fea305ec3 100644 --- a/crates/apub/src/http/mod.rs +++ b/crates/apub/src/http/mod.rs @@ -83,7 +83,6 @@ pub(crate) async fn get_activity( context: web::Data, ) -> Result { let mut conn = context.conn().await?; - let settings = context.settings(); let activity_id = Url::parse(&format!( "{}/activities/{}/{}", diff --git a/crates/apub/src/http/person.rs b/crates/apub/src/http/person.rs index 7fa6c51cc..cd83bea2d 100644 --- a/crates/apub/src/http/person.rs +++ b/crates/apub/src/http/person.rs @@ -29,7 +29,6 @@ pub(crate) async fn get_apub_person_http( context: Data, ) -> Result { let mut conn = context.conn().await?; - let user_name = info.into_inner().user_name; // TODO: this needs to be able to read deleted persons, so that it can send tombstones let person: ApubPerson = Person::read_from_name(&mut conn, &user_name, true) @@ -63,7 +62,6 @@ pub(crate) async fn get_apub_person_outbox( context: Data, ) -> Result { let mut conn = context.conn().await?; - let person = Person::read_from_name(&mut conn, &info.user_name, false).await?; let outbox_id = generate_outbox_url(&person.actor_id)?.into(); let outbox = EmptyOutbox::new(outbox_id)?; diff --git a/crates/apub/src/http/post.rs b/crates/apub/src/http/post.rs index 02e7c5a01..3ab1692c1 100644 --- a/crates/apub/src/http/post.rs +++ b/crates/apub/src/http/post.rs @@ -21,7 +21,6 @@ pub(crate) async fn get_apub_post( context: Data, ) -> Result { let mut conn = context.conn().await?; - let id = PostId(info.post_id.parse::()?); let post: ApubPost = Post::read(&mut conn, id).await?.into(); if !post.local { diff --git a/crates/apub/src/http/site.rs b/crates/apub/src/http/site.rs index 05cb46ebe..eadd9765c 100644 --- a/crates/apub/src/http/site.rs +++ b/crates/apub/src/http/site.rs @@ -20,7 +20,6 @@ pub(crate) async fn get_apub_site_http( context: Data, ) -> Result { let mut conn = context.conn().await?; - let site: ApubSite = SiteView::read_local(&mut conn).await?.site.into(); let apub = site.into_json(&context).await?; diff --git a/crates/apub/src/mentions.rs b/crates/apub/src/mentions.rs index 7287e6b89..24c10e8b6 100644 --- a/crates/apub/src/mentions.rs +++ b/crates/apub/src/mentions.rs @@ -46,7 +46,6 @@ pub async fn collect_non_local_mentions( context: &Data, ) -> Result { let mut conn = context.conn().await?; - let parent_creator = get_comment_parent_creator(&mut conn, comment).await?; let mut addressed_ccs: Vec = vec![community_id.into(), parent_creator.id()]; diff --git a/crates/apub/src/objects/comment.rs b/crates/apub/src/objects/comment.rs index fdc8cd5f8..91577a867 100644 --- a/crates/apub/src/objects/comment.rs +++ b/crates/apub/src/objects/comment.rs @@ -67,7 +67,6 @@ impl Object for ApubComment { context: &Data, ) -> Result, LemmyError> { let mut conn = context.conn().await?; - Ok( Comment::read_from_apub_id(&mut conn, object_id) .await? @@ -78,7 +77,6 @@ impl Object for ApubComment { #[tracing::instrument(skip_all)] async fn delete(self, context: &Data) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - if !self.deleted { let form = CommentUpdateForm::builder().deleted(Some(true)).build(); Comment::update(&mut conn, self.id, &form).await?; @@ -89,7 +87,6 @@ impl Object for ApubComment { #[tracing::instrument(skip_all)] async fn into_json(self, context: &Data) -> Result { let mut conn = context.conn().await?; - let creator_id = self.creator_id; let creator = Person::read(&mut conn, creator_id).await?; @@ -135,7 +132,6 @@ impl Object for ApubComment { context: &Data, ) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - verify_domains_match(note.id.inner(), expected_domain)?; verify_domains_match(note.attributed_to.inner(), note.id.inner())?; verify_is_public(¬e.to, ¬e.cc)?; @@ -163,7 +159,6 @@ impl Object for ApubComment { #[tracing::instrument(skip_all)] async fn from_json(note: Note, context: &Data) -> Result { let mut conn = context.conn().await?; - let creator = note.attributed_to.dereference(context).await?; let (post, parent_comment) = note.get_parents(context).await?; diff --git a/crates/apub/src/objects/community.rs b/crates/apub/src/objects/community.rs index e5a1f69a7..5b646ceeb 100644 --- a/crates/apub/src/objects/community.rs +++ b/crates/apub/src/objects/community.rs @@ -67,7 +67,6 @@ impl Object for ApubCommunity { context: &Data, ) -> Result, LemmyError> { let mut conn = context.conn().await?; - Ok( Community::read_from_apub_id(&mut conn, &object_id.into()) .await? @@ -78,7 +77,6 @@ impl Object for ApubCommunity { #[tracing::instrument(skip_all)] async fn delete(self, context: &Data) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - let form = CommunityUpdateForm::builder().deleted(Some(true)).build(); Community::update(&mut conn, self.id, &form).await?; Ok(()) @@ -133,7 +131,6 @@ impl Object for ApubCommunity { context: &Data, ) -> Result { let mut conn = context.conn().await?; - let instance_id = fetch_instance_actor_for_object(&group.id, context).await?; let form = Group::into_insert_form(group.clone(), instance_id); @@ -192,7 +189,6 @@ impl ApubCommunity { context: &LemmyContext, ) -> Result, LemmyError> { let mut conn = context.conn().await?; - let id = self.id; let local_site_data = fetch_local_site_data(&mut conn).await?; diff --git a/crates/apub/src/objects/instance.rs b/crates/apub/src/objects/instance.rs index bd8212886..01befebc3 100644 --- a/crates/apub/src/objects/instance.rs +++ b/crates/apub/src/objects/instance.rs @@ -177,7 +177,6 @@ pub(in crate::objects) async fn fetch_instance_actor_for_object + C context: &Data, ) -> Result { let mut conn = context.conn().await?; - let object_id: Url = object_id.clone().into(); let instance_id = Site::instance_actor_id_from_url(object_id); let site = ObjectId::::from(instance_id.clone()) diff --git a/crates/apub/src/objects/post.rs b/crates/apub/src/objects/post.rs index 47498494d..4f3e60237 100644 --- a/crates/apub/src/objects/post.rs +++ b/crates/apub/src/objects/post.rs @@ -83,7 +83,6 @@ impl Object for ApubPost { context: &Data, ) -> Result, LemmyError> { let mut conn = context.conn().await?; - Ok( Post::read_from_apub_id(&mut conn, object_id) .await? @@ -94,7 +93,6 @@ impl Object for ApubPost { #[tracing::instrument(skip_all)] async fn delete(self, context: &Data) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - if !self.deleted { let form = PostUpdateForm::builder().deleted(Some(true)).build(); Post::update(&mut conn, self.id, &form).await?; @@ -106,7 +104,6 @@ impl Object for ApubPost { #[tracing::instrument(skip_all)] async fn into_json(self, context: &Data) -> Result { let mut conn = context.conn().await?; - let creator_id = self.creator_id; let creator = Person::read(&mut conn, creator_id).await?; let community_id = self.community_id; @@ -142,9 +139,8 @@ impl Object for ApubPost { expected_domain: &Url, context: &Data, ) -> Result<(), LemmyError> { - let mut conn = context.conn().await?; - // We can't verify the domain in case of mod action, because the mod may be on a different - // instance from the post author. + let mut conn = context.conn().await?; // We can't verify the domain in case of mod action, because the mod may be on a different + // instance from the post author. if !page.is_mod_action(context).await? { verify_domains_match(page.id.inner(), expected_domain)?; verify_is_remote_object(page.id.inner(), context.settings())?; @@ -172,7 +168,6 @@ impl Object for ApubPost { #[tracing::instrument(skip_all)] async fn from_json(page: Page, context: &Data) -> Result { let mut conn = context.conn().await?; - let creator = page.creator()?.dereference(context).await?; let community = page.community(context).await?; if community.posting_restricted_to_mods { diff --git a/crates/apub/src/protocol/activities/community/collection_add.rs b/crates/apub/src/protocol/activities/community/collection_add.rs index 5afc6dc32..fe38f07bb 100644 --- a/crates/apub/src/protocol/activities/community/collection_add.rs +++ b/crates/apub/src/protocol/activities/community/collection_add.rs @@ -35,7 +35,6 @@ pub struct CollectionAdd { impl InCommunity for CollectionAdd { async fn community(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let (community, _) = Community::get_by_collection_url(&mut conn, &self.clone().target.into()).await?; if let Some(audience) = &self.audience { diff --git a/crates/apub/src/protocol/activities/community/collection_remove.rs b/crates/apub/src/protocol/activities/community/collection_remove.rs index fc696eba3..5d586ccae 100644 --- a/crates/apub/src/protocol/activities/community/collection_remove.rs +++ b/crates/apub/src/protocol/activities/community/collection_remove.rs @@ -35,7 +35,6 @@ pub struct CollectionRemove { impl InCommunity for CollectionRemove { async fn community(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let (community, _) = Community::get_by_collection_url(&mut conn, &self.clone().target.into()).await?; if let Some(audience) = &self.audience { diff --git a/crates/apub/src/protocol/activities/community/lock_page.rs b/crates/apub/src/protocol/activities/community/lock_page.rs index 10c39ae9e..037843033 100644 --- a/crates/apub/src/protocol/activities/community/lock_page.rs +++ b/crates/apub/src/protocol/activities/community/lock_page.rs @@ -55,7 +55,6 @@ pub struct UndoLockPage { impl InCommunity for LockPage { async fn community(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let post = self.object.dereference(context).await?; let community = Community::read(&mut conn, post.community_id).await?; if let Some(audience) = &self.audience { 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 f79fa7f83..6f3197e8b 100644 --- a/crates/apub/src/protocol/activities/create_or_update/note.rs +++ b/crates/apub/src/protocol/activities/create_or_update/note.rs @@ -36,7 +36,6 @@ pub struct CreateOrUpdateNote { impl InCommunity for CreateOrUpdateNote { async fn community(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let post = self.object.get_parents(context).await?.0; let community = Community::read(&mut conn, post.community_id).await?; if let Some(audience) = &self.audience { diff --git a/crates/apub/src/protocol/activities/deletion/delete.rs b/crates/apub/src/protocol/activities/deletion/delete.rs index 2f7b0509f..fd3c8144c 100644 --- a/crates/apub/src/protocol/activities/deletion/delete.rs +++ b/crates/apub/src/protocol/activities/deletion/delete.rs @@ -46,7 +46,6 @@ pub struct Delete { impl InCommunity for Delete { async fn community(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let community_id = match DeletableObjects::read_from_db(self.object.id(), context).await? { DeletableObjects::Community(c) => c.id, DeletableObjects::Comment(c) => { diff --git a/crates/apub/src/protocol/collections/group_followers.rs b/crates/apub/src/protocol/collections/group_followers.rs index 577f86a42..f477cb4fc 100644 --- a/crates/apub/src/protocol/collections/group_followers.rs +++ b/crates/apub/src/protocol/collections/group_followers.rs @@ -21,7 +21,6 @@ impl GroupFollowers { context: &LemmyContext, ) -> Result { let mut conn = context.conn().await?; - let community_id = community.id; let community_followers = CommunityFollowerView::for_community(&mut conn, community_id).await?; diff --git a/crates/apub/src/protocol/objects/group.rs b/crates/apub/src/protocol/objects/group.rs index 14501e2e2..a9788c1ee 100644 --- a/crates/apub/src/protocol/objects/group.rs +++ b/crates/apub/src/protocol/objects/group.rs @@ -81,7 +81,6 @@ impl Group { context: &LemmyContext, ) -> Result<(), LemmyError> { let mut conn = context.conn().await?; - let local_site_data = fetch_local_site_data(&mut conn).await?; check_apub_id_valid_with_strictness( diff --git a/crates/apub/src/protocol/objects/note.rs b/crates/apub/src/protocol/objects/note.rs index 13da744d7..dedeede14 100644 --- a/crates/apub/src/protocol/objects/note.rs +++ b/crates/apub/src/protocol/objects/note.rs @@ -58,8 +58,7 @@ impl Note { &self, context: &Data, ) -> Result<(ApubPost, Option), LemmyError> { - let mut conn = context.conn().await?; - // Fetch parent comment chain in a box, otherwise it can cause a stack overflow. + let mut conn = context.conn().await?; // Fetch parent comment chain in a box, otherwise it can cause a stack overflow. let parent = Box::pin(self.in_reply_to.dereference(context).await?); match parent.deref() { PostOrComment::Post(p) => Ok((p.clone(), None)), @@ -76,7 +75,6 @@ impl Note { impl InCommunity for Note { async fn community(&self, context: &Data) -> Result { let mut conn = context.conn().await?; - let (post, _) = self.get_parents(context).await?; let community = Community::read(&mut conn, post.community_id).await?; if let Some(audience) = &self.audience { diff --git a/crates/db_schema/src/impls/actor_language.rs b/crates/db_schema/src/impls/actor_language.rs index 692bafff6..c730d725d 100644 --- a/crates/db_schema/src/impls/actor_language.rs +++ b/crates/db_schema/src/impls/actor_language.rs @@ -561,7 +561,6 @@ mod tests { #[serial] async fn test_community_languages() { let conn = &mut build_db_conn_for_tests().await; - let (site, instance) = create_test_site(conn).await; let test_langs = test_langs1(conn).await; SiteLanguage::update(conn, test_langs.clone(), &site) @@ -623,7 +622,6 @@ mod tests { #[serial] async fn test_default_post_language() { let conn = &mut build_db_conn_for_tests().await; - let (site, instance) = create_test_site(conn).await; let test_langs = test_langs1(conn).await; let test_langs2 = test_langs2(conn).await; diff --git a/crates/db_schema/src/impls/federation_allowlist.rs b/crates/db_schema/src/impls/federation_allowlist.rs index 63d54077a..15b4c67d0 100644 --- a/crates/db_schema/src/impls/federation_allowlist.rs +++ b/crates/db_schema/src/impls/federation_allowlist.rs @@ -58,7 +58,6 @@ mod tests { #[serial] async fn test_allowlist_insert_and_clear() { let conn = &mut build_db_conn_for_tests().await; - let domains = vec![ "tld1.xyz".to_string(), "tld2.xyz".to_string(), diff --git a/crates/db_schema/src/impls/person.rs b/crates/db_schema/src/impls/person.rs index 72541a620..ef68a66b1 100644 --- a/crates/db_schema/src/impls/person.rs +++ b/crates/db_schema/src/impls/person.rs @@ -257,7 +257,6 @@ mod tests { #[serial] async fn follow() { let conn = &mut build_db_conn_for_tests().await; - let inserted_instance = Instance::read_or_create(conn, "my_domain.tld".to_string()) .await .unwrap(); diff --git a/crates/db_schema/src/utils.rs b/crates/db_schema/src/utils.rs index 3843b3447..f344df6a8 100644 --- a/crates/db_schema/src/utils.rs +++ b/crates/db_schema/src/utils.rs @@ -48,7 +48,6 @@ const POOL_TIMEOUT: Option = Some(Duration::from_secs(5)); pub type DbPool = Pool; pub type DbConn = AsyncPgConnection; - pub type DbPooledConn = PooledConnection; pub async fn get_conn(pool: &DbPool) -> Result, DieselError> { diff --git a/crates/db_views/src/comment_view.rs b/crates/db_views/src/comment_view.rs index ece7c95ed..dcc114f07 100644 --- a/crates/db_views/src/comment_view.rs +++ b/crates/db_views/src/comment_view.rs @@ -588,7 +588,6 @@ mod tests { #[serial] async fn test_crud() { let conn = &mut build_db_conn_for_tests().await; - let data = init_data(conn).await; let expected_comment_view_no_person = expected_comment_view(&data, conn).await; @@ -646,7 +645,6 @@ mod tests { #[serial] async fn test_comment_tree() { let conn = &mut build_db_conn_for_tests().await; - let data = init_data(conn).await; let top_path = data.inserted_comment_0.path.clone(); @@ -723,7 +721,6 @@ mod tests { #[serial] async fn test_languages() { let conn = &mut build_db_conn_for_tests().await; - let data = init_data(conn).await; // by default, user has all languages enabled and should see all comments diff --git a/crates/db_views/src/post_report_view.rs b/crates/db_views/src/post_report_view.rs index 9102e526d..2b9d218d0 100644 --- a/crates/db_views/src/post_report_view.rs +++ b/crates/db_views/src/post_report_view.rs @@ -175,7 +175,6 @@ pub struct PostReportQuery<'a> { impl<'a> PostReportQuery<'a> { pub async fn list(self) -> Result, Error> { let conn = self.conn; - let (person_alias_1, person_alias_2) = diesel::alias!(person as person1, person as person2); let mut query = post_report::table diff --git a/crates/db_views/src/post_view.rs b/crates/db_views/src/post_view.rs index 8536ac14b..c4e21c60c 100644 --- a/crates/db_views/src/post_view.rs +++ b/crates/db_views/src/post_view.rs @@ -606,7 +606,6 @@ mod tests { #[serial] async fn post_listing_with_person() { let conn = &mut build_db_conn_for_tests().await; - let data = init_data(conn).await; let local_user_form = LocalUserUpdateForm::builder() @@ -675,7 +674,6 @@ mod tests { #[serial] async fn post_listing_no_person() { let conn = &mut build_db_conn_for_tests().await; - let data = init_data(conn).await; let read_post_listing_multiple_no_person = PostQuery::builder() @@ -713,7 +711,6 @@ mod tests { #[serial] async fn post_listing_block_community() { let conn = &mut build_db_conn_for_tests().await; - let data = init_data(conn).await; let community_block = CommunityBlockForm { @@ -744,7 +741,6 @@ mod tests { #[serial] async fn post_listing_like() { let conn = &mut build_db_conn_for_tests().await; - let data = init_data(conn).await; let post_like_form = PostLikeForm { @@ -811,7 +807,6 @@ mod tests { #[serial] async fn post_listing_person_language() { let conn = &mut build_db_conn_for_tests().await; - let data = init_data(conn).await; let spanish_id = Language::read_id_from_code(conn, Some("es")) @@ -893,7 +888,6 @@ mod tests { #[serial] async fn post_listings_deleted() { let conn = &mut build_db_conn_for_tests().await; - let data = init_data(conn).await; // Delete the post diff --git a/crates/db_views/src/private_message_report_view.rs b/crates/db_views/src/private_message_report_view.rs index c73bcaafc..62a007eaf 100644 --- a/crates/db_views/src/private_message_report_view.rs +++ b/crates/db_views/src/private_message_report_view.rs @@ -89,7 +89,6 @@ pub struct PrivateMessageReportQuery<'a> { impl<'a> PrivateMessageReportQuery<'a> { pub async fn list(self) -> Result, Error> { let conn = self.conn; - let (person_alias_1, person_alias_2) = diesel::alias!(person as person1, person as person2); let mut query = private_message_report::table diff --git a/crates/db_views/src/private_message_view.rs b/crates/db_views/src/private_message_view.rs index be6c39ec3..f110b0b6c 100644 --- a/crates/db_views/src/private_message_view.rs +++ b/crates/db_views/src/private_message_view.rs @@ -81,7 +81,6 @@ pub struct PrivateMessageQuery<'a> { impl<'a> PrivateMessageQuery<'a> { pub async fn list(self) -> Result, Error> { let conn = self.conn; - let person_alias_1 = diesel::alias!(person as person1); let mut query = private_message::table diff --git a/crates/db_views/src/registration_application_view.rs b/crates/db_views/src/registration_application_view.rs index dc9a6f265..f5aaa21c9 100644 --- a/crates/db_views/src/registration_application_view.rs +++ b/crates/db_views/src/registration_application_view.rs @@ -98,7 +98,6 @@ pub struct RegistrationApplicationQuery<'a> { impl<'a> RegistrationApplicationQuery<'a> { pub async fn list(self) -> Result, Error> { let conn = self.conn; - let person_alias_1 = diesel::alias!(person as person1); let mut query = registration_application::table diff --git a/src/scheduled_tasks.rs b/src/scheduled_tasks.rs index a918c9fb4..4d3c936e8 100644 --- a/src/scheduled_tasks.rs +++ b/src/scheduled_tasks.rs @@ -38,7 +38,6 @@ pub fn setup( let url = db_url.clone(); scheduler.every(CTimeUnits::hour(1)).run(move || { let mut conn = PgConnection::establish(&url).expect("could not establish connection"); - active_counts(&mut conn); update_banned_when_expired(&mut conn); }); @@ -47,7 +46,6 @@ pub fn setup( let url = db_url.clone(); scheduler.every(CTimeUnits::minutes(15)).run(move || { let mut conn = PgConnection::establish(&url).expect("could not establish connection"); - update_hot_ranks(&mut conn, true); }); @@ -55,7 +53,6 @@ pub fn setup( let url = db_url.clone(); scheduler.every(CTimeUnits::minutes(10)).run(move || { let mut conn = PgConnection::establish(&url).expect("could not establish connection"); - delete_expired_captcha_answers(&mut conn); }); @@ -63,7 +60,6 @@ pub fn setup( let url = db_url.clone(); scheduler.every(CTimeUnits::weeks(1)).run(move || { let mut conn = PgConnection::establish(&url).expect("could not establish connection"); - clear_old_activities(&mut conn); }); @@ -77,14 +73,12 @@ pub fn setup( let url = db_url.clone(); scheduler.every(CTimeUnits::days(1)).run(move || { let mut conn = PgConnection::establish(&url).expect("could not establish connection"); - overwrite_deleted_posts_and_comments(&mut conn); }); // Update the Instance Software scheduler.every(CTimeUnits::days(1)).run(move || { let mut conn = PgConnection::establish(&db_url).expect("could not establish connection"); - update_instance_software(&mut conn, &user_agent); }); @@ -98,7 +92,6 @@ pub fn setup( /// Run these on server startup fn startup_jobs(db_url: &str) { let mut conn = PgConnection::establish(db_url).expect("could not establish connection"); - active_counts(&mut conn); update_hot_ranks(&mut conn, false); update_banned_when_expired(&mut conn);