|
|
@ -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,7 +29,6 @@ use lemmy_db_schema::{
|
|
|
|
CommunityVisibility,
|
|
|
|
CommunityVisibility,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
use lemmy_db_views::structs::LocalUserView;
|
|
|
|
use lemmy_db_views::structs::LocalUserView;
|
|
|
|
use lemmy_db_views_actor::structs::CommunityView;
|
|
|
|
|
|
|
|
use lemmy_utils::{
|
|
|
|
use lemmy_utils::{
|
|
|
|
error::{LemmyError, LemmyErrorExt, LemmyErrorType},
|
|
|
|
error::{LemmyError, LemmyErrorExt, LemmyErrorType},
|
|
|
|
spawn_try_task,
|
|
|
|
spawn_try_task,
|
|
|
@ -83,10 +82,10 @@ pub async fn create_post(
|
|
|
|
let community = Community::read(&mut context.pool(), community_id).await?;
|
|
|
|
let community = Community::read(&mut context.pool(), community_id).await?;
|
|
|
|
if community.posting_restricted_to_mods {
|
|
|
|
if community.posting_restricted_to_mods {
|
|
|
|
let community_id = data.community_id;
|
|
|
|
let community_id = data.community_id;
|
|
|
|
let is_mod = CommunityView::is_mod_or_admin(
|
|
|
|
let is_mod = CommunityModeratorView::is_community_moderator(
|
|
|
|
&mut context.pool(),
|
|
|
|
&mut context.pool(),
|
|
|
|
local_user_view.local_user.person_id,
|
|
|
|
|
|
|
|
community_id,
|
|
|
|
community_id,
|
|
|
|
|
|
|
|
local_user_view.local_user.person_id,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.await?;
|
|
|
|
.await?;
|
|
|
|
if !is_mod {
|
|
|
|
if !is_mod {
|
|
|
|