mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-12-22 01:08:37 +00:00
Fixing broken SQL migration formatting. (#3800)
* Fixing SQL format. * Fixing clippy lints. * Fixing clippy lint 2.
This commit is contained in:
parent
2d0f77af59
commit
70fae9d68d
|
@ -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(())
|
||||
}
|
||||
|
|
|
@ -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)?;
|
||||
|
|
|
@ -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(())
|
||||
}
|
||||
|
|
|
@ -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...
|
||||
|
|
|
@ -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?;
|
||||
}
|
||||
|
||||
|
|
|
@ -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(())
|
||||
}
|
||||
|
|
|
@ -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(())
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue