Allow author of parent post to be added to audience of direct message

This commit is contained in:
silverpill 2022-01-21 11:43:23 +00:00
parent 8e53214830
commit 5d2c3e85eb

View file

@ -99,9 +99,10 @@ async fn create_status(
return Err(ValidationError("post visibility doesn't match the parent").into());
};
if post_data.visibility != Visibility::Public {
let in_reply_to_mentions: Vec<_> = in_reply_to.mentions.iter()
let mut in_reply_to_audience: Vec<_> = in_reply_to.mentions.iter()
.map(|profile| profile.id).collect();
if !post_data.mentions.iter().all(|id| in_reply_to_mentions.contains(id)) {
in_reply_to_audience.push(in_reply_to.author.id);
if !post_data.mentions.iter().all(|id| in_reply_to_audience.contains(id)) {
return Err(ValidationError("audience can't be expanded").into());
};
};