Fixing broken SQL migration formatting. (#3800)

* Fixing SQL format.

* Fixing clippy lints.

* Fixing clippy lint 2.
This commit is contained in:
Dessalines 2023-08-03 05:07:35 -04:00 committed by GitHub
parent 2d0f77af59
commit 70fae9d68d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 22 additions and 20 deletions

View file

@ -40,7 +40,7 @@ pub(crate) fn captcha_as_wav_base64(captcha: &Captcha) -> Result<String, LemmyEr
if let Some(samples16) = samples.as_sixteen() {
concat_samples.extend(samples16);
} else {
return Err(LemmyErrorType::CouldntCreateAudioCaptcha)?;
Err(LemmyErrorType::CouldntCreateAudioCaptcha)?;
}
}
@ -66,10 +66,10 @@ pub(crate) fn check_report_reason(reason: &str, local_site: &LocalSite) -> 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(())
}

View file

@ -44,7 +44,7 @@ fn html_to_site_metadata(html_bytes: &[u8], url: &Url) -> Result<SiteMetadata, L
.to_lowercase();
if !first_line.starts_with("<!doctype html>") {
return Err(LemmyErrorType::SiteMetadataPageIsNotDoctypeHtml)?;
Err(LemmyErrorType::SiteMetadataPageIsNotDoctypeHtml)?;
}
let mut page = HTML::from_string(html.to_string(), None)?;

View file

@ -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(())
}

View file

@ -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...

View file

@ -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?;
}

View file

@ -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<ApubCommunity> = b.into();
if a != &b {
return Err(LemmyErrorType::InvalidCommunity)?;
Err(LemmyErrorType::InvalidCommunity)?;
}
Ok(())
}

View file

@ -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(())

View file

@ -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;

View file

@ -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;