fix: check permissions before asking about a post
This commit is contained in:
parent
73d8e9ab49
commit
052ddf862f
1 changed files with 16 additions and 0 deletions
|
@ -427,6 +427,22 @@ impl DataManager {
|
|||
}
|
||||
}
|
||||
|
||||
// check asking_about
|
||||
if let Some(id) = data.context.asking_about {
|
||||
let post = self.get_post_by_id(id).await?;
|
||||
let owner = self.get_user_by_id(post.owner).await?;
|
||||
|
||||
if post.stack != 0 {
|
||||
return Err(Error::MiscError(
|
||||
"Cannot ask about posts in a circle".to_string(),
|
||||
));
|
||||
} else if owner.settings.private_profile {
|
||||
return Err(Error::MiscError(
|
||||
"Cannot ask about posts from a private user".to_string(),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
// create uploads
|
||||
if drawings.len() > 2 {
|
||||
return Err(Error::MiscError(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue