mirror of
https://github.com/LemmyNet/lemmy.git
synced 2025-01-10 03:55:54 +00:00
Automatically marking posts created in an NSFW community as NSFW. (#5310)
* Automatically marking posts created in an NSFW community as NSFW. - Context: https://github.com/LemmyNet/lemmy-ui/issues/2885 * Update crates/api_crud/src/post/create.rs Co-authored-by: Nutomic <me@nutomic.com> --------- Co-authored-by: Nutomic <me@nutomic.com>
This commit is contained in:
parent
c81144cd14
commit
d83f96293d
1 changed files with 4 additions and 1 deletions
|
@ -86,6 +86,9 @@ pub async fn create_post(
|
|||
let community = Community::read(&mut context.pool(), data.community_id).await?;
|
||||
check_community_user_action(&local_user_view.person, &community, &mut context.pool()).await?;
|
||||
|
||||
// If its an NSFW community, then use that as a default
|
||||
let nsfw = data.nsfw.or(Some(community.nsfw));
|
||||
|
||||
if community.posting_restricted_to_mods {
|
||||
let community_id = data.community_id;
|
||||
CommunityModeratorView::check_is_community_moderator(
|
||||
|
@ -110,7 +113,7 @@ pub async fn create_post(
|
|||
url,
|
||||
body,
|
||||
alt_text: data.alt_text.clone(),
|
||||
nsfw: data.nsfw,
|
||||
nsfw,
|
||||
language_id: Some(language_id),
|
||||
scheduled_publish_time,
|
||||
..PostInsertForm::new(
|
||||
|
|
Loading…
Reference in a new issue