From: Dessalines Date: Thu, 3 Aug 2023 09:07:35 +0000 (-0400) Subject: Fixing broken SQL migration formatting. (#3800) X-Git-Url: http://these/git/README.ja.md?a=commitdiff_plain;h=70fae9d68d65b1e4d153e30d3c065cc315b75eaf;p=lemmy.git Fixing broken SQL migration formatting. (#3800) * Fixing SQL format. * Fixing clippy lints. * Fixing clippy lint 2. --- diff --git a/crates/api/src/lib.rs b/crates/api/src/lib.rs index cc5fb8e8..1b7b3215 100644 --- a/crates/api/src/lib.rs +++ b/crates/api/src/lib.rs @@ -40,7 +40,7 @@ pub(crate) fn captcha_as_wav_base64(captcha: &Captcha) -> Result Resul check_slurs(reason, slur_regex)?; if reason.is_empty() { - return Err(LemmyErrorType::ReportReasonRequired)?; + Err(LemmyErrorType::ReportReasonRequired)?; } if reason.chars().count() > 1000 { - return Err(LemmyErrorType::ReportTooLong)?; + Err(LemmyErrorType::ReportTooLong)?; } Ok(()) } diff --git a/crates/api_common/src/request.rs b/crates/api_common/src/request.rs index 82126887..b62514c0 100644 --- a/crates/api_common/src/request.rs +++ b/crates/api_common/src/request.rs @@ -44,7 +44,7 @@ fn html_to_site_metadata(html_bytes: &[u8], url: &Url) -> Result") { - return Err(LemmyErrorType::SiteMetadataPageIsNotDoctypeHtml)?; + Err(LemmyErrorType::SiteMetadataPageIsNotDoctypeHtml)?; } let mut page = HTML::from_string(html.to_string(), None)?; diff --git a/crates/api_common/src/utils.rs b/crates/api_common/src/utils.rs index 6bdc3028..f3cebebd 100644 --- a/crates/api_common/src/utils.rs +++ b/crates/api_common/src/utils.rs @@ -79,7 +79,7 @@ pub async fn is_mod_or_admin_opt( pub fn is_admin(local_user_view: &LocalUserView) -> Result<(), LemmyError> { if !local_user_view.person.admin { - return Err(LemmyErrorType::NotAnAdmin)?; + Err(LemmyErrorType::NotAnAdmin)?; } Ok(()) } @@ -94,7 +94,7 @@ pub fn is_top_mod( .map(|cm| cm.moderator.id) .unwrap_or(PersonId(0)) { - return Err(LemmyErrorType::NotTopMod)?; + Err(LemmyErrorType::NotTopMod)?; } Ok(()) } @@ -181,12 +181,12 @@ pub fn check_user_valid( ) -> Result<(), LemmyError> { // Check for a site ban if is_banned(banned, ban_expires) { - return Err(LemmyErrorType::SiteBan)?; + Err(LemmyErrorType::SiteBan)?; } // check for account deletion if deleted { - return Err(LemmyErrorType::Deleted)?; + Err(LemmyErrorType::Deleted)?; } Ok(()) @@ -250,7 +250,7 @@ pub async fn check_person_block( #[tracing::instrument(skip_all)] pub fn check_downvotes_enabled(score: i16, local_site: &LocalSite) -> Result<(), LemmyError> { if score == -1 && !local_site.enable_downvotes { - return Err(LemmyErrorType::DownvotesAreDisabled)?; + Err(LemmyErrorType::DownvotesAreDisabled)?; } Ok(()) } @@ -261,7 +261,7 @@ pub fn check_private_instance( local_site: &LocalSite, ) -> Result<(), LemmyError> { if local_user_view.is_none() && local_site.private_instance { - return Err(LemmyErrorType::InstanceIsPrivate)?; + Err(LemmyErrorType::InstanceIsPrivate)?; } Ok(()) } @@ -522,7 +522,7 @@ pub fn check_private_instance_and_federation_enabled( local_site: &LocalSite, ) -> Result<(), LemmyError> { if local_site.private_instance && local_site.federation_enabled { - return Err(LemmyErrorType::CantEnablePrivateInstanceAndFederationTogether)?; + Err(LemmyErrorType::CantEnablePrivateInstanceAndFederationTogether)?; } Ok(()) } diff --git a/crates/api_crud/src/site/create.rs b/crates/api_crud/src/site/create.rs index 59a57ff8..f7beb254 100644 --- a/crates/api_crud/src/site/create.rs +++ b/crates/api_crud/src/site/create.rs @@ -144,7 +144,7 @@ pub async fn create_site( fn validate_create_payload(local_site: &LocalSite, create_site: &CreateSite) -> LemmyResult<()> { // Make sure the site hasn't already been set up... if local_site.site_setup { - return Err(LemmyErrorType::SiteAlreadyExists)?; + Err(LemmyErrorType::SiteAlreadyExists)?; }; // Check that the slur regex compiles, and returns the regex if valid... diff --git a/crates/apub/src/activities/deletion/mod.rs b/crates/apub/src/activities/deletion/mod.rs index 535a2af1..e03074f1 100644 --- a/crates/apub/src/activities/deletion/mod.rs +++ b/crates/apub/src/activities/deletion/mod.rs @@ -251,7 +251,7 @@ async fn receive_delete_action( if community.local { let mod_: Person = actor.dereference(context).await?.deref().clone(); let object = DeletableObjects::Community(community.clone()); - let c: Community = community.deref().deref().clone(); + let c: Community = community.deref().clone(); send_apub_delete_in_community(mod_, c, object, None, true, context).await?; } diff --git a/crates/apub/src/activities/mod.rs b/crates/apub/src/activities/mod.rs index 885abc60..bc8379f1 100644 --- a/crates/apub/src/activities/mod.rs +++ b/crates/apub/src/activities/mod.rs @@ -143,7 +143,7 @@ pub(crate) async fn verify_mod_action( pub(crate) fn verify_is_public(to: &[Url], cc: &[Url]) -> Result<(), LemmyError> { if ![to, cc].iter().any(|set| set.contains(&public())) { - return Err(LemmyErrorType::ObjectIsNotPublic)?; + Err(LemmyErrorType::ObjectIsNotPublic)?; } Ok(()) } @@ -157,7 +157,7 @@ where { let b: ObjectId = b.into(); if a != &b { - return Err(LemmyErrorType::InvalidCommunity)?; + Err(LemmyErrorType::InvalidCommunity)?; } Ok(()) } diff --git a/crates/apub/src/lib.rs b/crates/apub/src/lib.rs index e920e05d..d4e34f9e 100644 --- a/crates/apub/src/lib.rs +++ b/crates/apub/src/lib.rs @@ -78,7 +78,7 @@ fn check_apub_id_valid(apub_id: &Url, local_site_data: &LocalSiteData) -> Result .map(|l| l.federation_enabled) .unwrap_or(true) { - return Err(LemmyErrorType::FederationDisabled)?; + Err(LemmyErrorType::FederationDisabled)?; } if local_site_data @@ -86,7 +86,7 @@ fn check_apub_id_valid(apub_id: &Url, local_site_data: &LocalSiteData) -> Result .iter() .any(|i| domain.eq(&i.domain)) { - return Err(LemmyErrorType::DomainBlocked(domain))?; + Err(LemmyErrorType::DomainBlocked(domain.clone()))?; } // Only check this if there are instances in the allowlist @@ -96,7 +96,7 @@ fn check_apub_id_valid(apub_id: &Url, local_site_data: &LocalSiteData) -> Result .iter() .any(|i| domain.eq(&i.domain)) { - return Err(LemmyErrorType::DomainNotInAllowList(domain))?; + Err(LemmyErrorType::DomainNotInAllowList(domain))?; } Ok(()) diff --git a/migrations/2023-08-02-144930_password-reset-token/down.sql b/migrations/2023-08-02-144930_password-reset-token/down.sql index 5f938da2..551d6fda 100644 --- a/migrations/2023-08-02-144930_password-reset-token/down.sql +++ b/migrations/2023-08-02-144930_password-reset-token/down.sql @@ -1 +1,2 @@ -alter table password_reset_request rename column token to token_encrypted; +ALTER TABLE password_reset_request RENAME COLUMN token TO token_encrypted; + diff --git a/migrations/2023-08-02-144930_password-reset-token/up.sql b/migrations/2023-08-02-144930_password-reset-token/up.sql index 0bdd1655..f0e1a407 100644 --- a/migrations/2023-08-02-144930_password-reset-token/up.sql +++ b/migrations/2023-08-02-144930_password-reset-token/up.sql @@ -1 +1,2 @@ -alter table password_reset_request rename column token_encrypted to token; +ALTER TABLE password_reset_request RENAME COLUMN token_encrypted TO token; +