Compare commits

..

No commits in common. 'cf426493e1f4fd3364cacf65e3eec32b61c1e136' and '66e06b39529d397693fd414d6e2bec8519e3415e' have entirely different histories.

2
Cargo.lock generated

@ -2588,7 +2588,7 @@ dependencies = [
"actix-web",
"actix-web-httpauth",
"anyhow",
"base64 0.22.0",
"base64 0.21.7",
"bcrypt",
"captcha",
"chrono",

@ -36,20 +36,8 @@ pub async fn add_mod_to_community(
let community = Community::read(&mut context.pool(), community_id)
.await?
.ok_or(LemmyErrorType::CouldntFindCommunity)?;
// If user is admin and community is remote, explicitly check that he is a
// moderator. This is necessary because otherwise the action would be rejected
// by the community's home instance.
if local_user_view.local_user.admin && !community.local {
let is_mod = CommunityModeratorView::is_community_moderator(
&mut context.pool(),
community.id,
local_user_view.person.id,
)
.await?;
if !is_mod {
Err(LemmyErrorType::NotAModerator)?
}
Err(LemmyErrorType::NotAModerator)?
}
// Update in local database

@ -40,11 +40,6 @@ impl AdminPurgeCommentView {
query = query.filter(admin_purge_comment::admin_person_id.eq(admin_person_id));
};
// If a post or comment ID is given, then don't find any results
if params.post_id.is_some() || params.comment_id.is_some() {
return Ok(vec![]);
}
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
query

@ -38,11 +38,6 @@ impl AdminPurgeCommunityView {
query = query.filter(admin_purge_community::admin_person_id.eq(admin_person_id));
};
// If a post or comment ID is given, then don't find any results
if params.post_id.is_some() || params.comment_id.is_some() {
return Ok(vec![]);
}
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
query

@ -38,11 +38,6 @@ impl AdminPurgePersonView {
query = query.filter(admin_purge_person::admin_person_id.eq(admin_person_id));
};
// If a post or comment ID is given, then don't find any results
if params.post_id.is_some() || params.comment_id.is_some() {
return Ok(vec![]);
}
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
query

@ -40,11 +40,6 @@ impl AdminPurgePostView {
query = query.filter(admin_purge_post::admin_person_id.eq(admin_person_id));
};
// If a post or comment ID is given, then don't find any results
if params.post_id.is_some() || params.comment_id.is_some() {
return Ok(vec![]);
}
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
query

@ -52,11 +52,6 @@ impl ModAddCommunityView {
query = query.filter(person_alias_1.field(person::id).eq(other_person_id));
};
// If a post or comment ID is given, then don't find any results
if params.post_id.is_some() || params.comment_id.is_some() {
return Ok(vec![]);
}
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
query

@ -44,11 +44,6 @@ impl ModAddView {
query = query.filter(person_alias_1.field(person::id).eq(other_person_id));
};
// If a post or comment ID is given, then don't find any results
if params.post_id.is_some() || params.comment_id.is_some() {
return Ok(vec![]);
}
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
query

@ -54,11 +54,6 @@ impl ModBanFromCommunityView {
query = query.filter(mod_ban_from_community::other_person_id.eq(other_person_id));
};
// If a post or comment ID is given, then don't find any results
if params.post_id.is_some() || params.comment_id.is_some() {
return Ok(vec![]);
}
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
query

@ -44,11 +44,6 @@ impl ModBanView {
query = query.filter(person_alias_1.field(person::id).eq(other_person_id));
};
// If a post or comment ID is given, then don't find any results
if params.post_id.is_some() || params.comment_id.is_some() {
return Ok(vec![]);
}
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
query

@ -55,11 +55,6 @@ impl ModFeaturePostView {
query = query.filter(post::id.eq(post_id));
}
// If a comment ID is given, then don't find any results
if params.comment_id.is_some() {
return Ok(vec![]);
}
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
query

@ -45,11 +45,6 @@ impl ModHideCommunityView {
query = query.filter(mod_hide_community::mod_person_id.eq(admin_id));
};
// If a post or comment ID is given, then don't find any results
if params.post_id.is_some() || params.comment_id.is_some() {
return Ok(vec![]);
}
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
query

@ -56,11 +56,6 @@ impl ModLockPostView {
query = query.filter(post::id.eq(post_id));
}
// If a comment ID is given, then don't find any results
if params.comment_id.is_some() {
return Ok(vec![]);
}
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
query

@ -58,11 +58,6 @@ impl ModRemoveCommentView {
query = query.filter(comment::id.eq(comment_id));
}
// If a post ID is given, then don't find any results
if params.post_id.is_some() {
return Ok(vec![]);
}
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
query

@ -39,11 +39,6 @@ impl ModRemoveCommunityView {
query = query.filter(mod_remove_community::mod_person_id.eq(mod_person_id));
};
// If a post or comment ID is given, then don't find any results
if params.post_id.is_some() || params.comment_id.is_some() {
return Ok(vec![]);
}
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
query

@ -56,11 +56,6 @@ impl ModRemovePostView {
query = query.filter(post::id.eq(post_id));
}
// If a comment ID is given, then don't find any results
if params.comment_id.is_some() {
return Ok(vec![]);
}
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
query

@ -54,11 +54,6 @@ impl ModTransferCommunityView {
query = query.filter(person_alias_1.field(person::id).eq(other_person_id));
};
// If a post or comment ID is given, then don't find any results
if params.post_id.is_some() || params.comment_id.is_some() {
return Ok(vec![]);
}
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
query

Loading…
Cancel
Save