community-restricted-only-mods
Felix Ableitner 3 months ago
parent 4ffb3e007c
commit c30dd100cc

@ -16,7 +16,7 @@ use lemmy_api_common::{
proxy_image_link_opt_apub, proxy_image_link_opt_apub,
EndpointType, EndpointType,
}, },
};use lemmy_db_views_actor::structs::CommunityModeratorView; };
use lemmy_db_schema::{ use lemmy_db_schema::{
impls::actor_language::default_post_language, impls::actor_language::default_post_language,
source::{ source::{
@ -29,6 +29,7 @@ use lemmy_db_schema::{
CommunityVisibility, CommunityVisibility,
}; };
use lemmy_db_views::structs::LocalUserView; use lemmy_db_views::structs::LocalUserView;
use lemmy_db_views_actor::structs::CommunityModeratorView;
use lemmy_utils::{ use lemmy_utils::{
error::{LemmyError, LemmyErrorExt, LemmyErrorType}, error::{LemmyError, LemmyErrorExt, LemmyErrorType},
spawn_try_task, spawn_try_task,

@ -42,6 +42,7 @@ use lemmy_db_schema::{
}, },
traits::Crud, traits::Crud,
}; };
use lemmy_db_views_actor::structs::CommunityModeratorView;
use lemmy_utils::{ use lemmy_utils::{
error::LemmyError, error::LemmyError,
utils::{markdown::markdown_to_html, slurs::check_slurs_opt, validation::check_url_scheme}, utils::{markdown::markdown_to_html, slurs::check_slurs_opt, validation::check_url_scheme},
@ -49,7 +50,6 @@ use lemmy_utils::{
use std::ops::Deref; use std::ops::Deref;
use stringreader::StringReader; use stringreader::StringReader;
use url::Url; use url::Url;
use lemmy_db_views_actor::structs::CommunityModeratorView;
const MAX_TITLE_LENGTH: usize = 200; const MAX_TITLE_LENGTH: usize = 200;
@ -179,7 +179,8 @@ impl Object for ApubPost {
let creator = page.creator()?.dereference(context).await?; let creator = page.creator()?.dereference(context).await?;
let community = page.community(context).await?; let community = page.community(context).await?;
if community.posting_restricted_to_mods { if community.posting_restricted_to_mods {
CommunityModeratorView::is_community_moderator(&mut context.pool(), community.id, creator.id).await?; CommunityModeratorView::is_community_moderator(&mut context.pool(), community.id, creator.id)
.await?;
} }
let mut name = page let mut name = page
.name .name

Loading…
Cancel
Save