* Fixing SQL format.
* Fixing clippy lints.
* Fixing clippy lint 2.
if let Some(samples16) = samples.as_sixteen() {
concat_samples.extend(samples16);
} else {
- return Err(LemmyErrorType::CouldntCreateAudioCaptcha)?;
+ Err(LemmyErrorType::CouldntCreateAudioCaptcha)?;
}
}
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(())
}
.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)?;
pub fn is_admin(local_user_view: &LocalUserView) -> Result<(), LemmyError> {
if !local_user_view.person.admin {
- return Err(LemmyErrorType::NotAnAdmin)?;
+ Err(LemmyErrorType::NotAnAdmin)?;
}
Ok(())
}
.map(|cm| cm.moderator.id)
.unwrap_or(PersonId(0))
{
- return Err(LemmyErrorType::NotTopMod)?;
+ Err(LemmyErrorType::NotTopMod)?;
}
Ok(())
}
) -> 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(())
#[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(())
}
local_site: &LocalSite,
) -> Result<(), LemmyError> {
if local_user_view.is_none() && local_site.private_instance {
- return Err(LemmyErrorType::InstanceIsPrivate)?;
+ Err(LemmyErrorType::InstanceIsPrivate)?;
}
Ok(())
}
local_site: &LocalSite,
) -> Result<(), LemmyError> {
if local_site.private_instance && local_site.federation_enabled {
- return Err(LemmyErrorType::CantEnablePrivateInstanceAndFederationTogether)?;
+ Err(LemmyErrorType::CantEnablePrivateInstanceAndFederationTogether)?;
}
Ok(())
}
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...
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?;
}
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(())
}
{
let b: ObjectId<ApubCommunity> = b.into();
if a != &b {
- return Err(LemmyErrorType::InvalidCommunity)?;
+ Err(LemmyErrorType::InvalidCommunity)?;
}
Ok(())
}
.map(|l| l.federation_enabled)
.unwrap_or(true)
{
- return Err(LemmyErrorType::FederationDisabled)?;
+ Err(LemmyErrorType::FederationDisabled)?;
}
if local_site_data
.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
.iter()
.any(|i| domain.eq(&i.domain))
{
- return Err(LemmyErrorType::DomainNotInAllowList(domain))?;
+ Err(LemmyErrorType::DomainNotInAllowList(domain))?;
}
Ok(())
-alter table password_reset_request rename column token to token_encrypted;
+ALTER TABLE password_reset_request RENAME COLUMN token TO token_encrypted;
+
-alter table password_reset_request rename column token_encrypted to token;
+ALTER TABLE password_reset_request RENAME COLUMN token_encrypted TO token;
+