Require replies to non-public posts to have direct visibility

This commit is contained in:
silverpill 2022-02-13 18:16:51 +00:00
parent 79e7d960fb
commit a5d3aa488b

View file

@ -95,8 +95,9 @@ async fn create_status(
}, },
Err(other_error) => return Err(other_error.into()), Err(other_error) => return Err(other_error.into()),
}; };
if post_data.visibility != Visibility::Direct && post_data.visibility != in_reply_to.visibility { if in_reply_to.visibility != Visibility::Public &&
return Err(ValidationError("post visibility doesn't match the parent").into()); post_data.visibility != Visibility::Direct {
return Err(ValidationError("reply must have direct visibility").into());
}; };
if post_data.visibility != Visibility::Public { if post_data.visibility != Visibility::Public {
let mut in_reply_to_audience: Vec<_> = in_reply_to.mentions.iter() let mut in_reply_to_audience: Vec<_> = in_reply_to.mentions.iter()