Perform consistency checks on reposts in Post::new()
This commit is contained in:
parent
8ab79d8a77
commit
ee0095ce53
1 changed files with 12 additions and 0 deletions
|
@ -123,6 +123,18 @@ impl Post {
|
||||||
if db_author.is_local() != db_post.object_id.is_none() {
|
if db_author.is_local() != db_post.object_id.is_none() {
|
||||||
return Err(ConversionError);
|
return Err(ConversionError);
|
||||||
};
|
};
|
||||||
|
if db_post.repost_of_id.is_some() && (
|
||||||
|
db_post.content.len() != 0 ||
|
||||||
|
db_post.in_reply_to_id.is_some() ||
|
||||||
|
db_post.ipfs_cid.is_some() ||
|
||||||
|
db_post.token_id.is_some() ||
|
||||||
|
db_post.token_tx_id.is_some() ||
|
||||||
|
!db_attachments.is_empty() ||
|
||||||
|
!db_mentions.is_empty() ||
|
||||||
|
!db_tags.is_empty()
|
||||||
|
) {
|
||||||
|
return Err(ConversionError);
|
||||||
|
};
|
||||||
let post = Self {
|
let post = Self {
|
||||||
id: db_post.id,
|
id: db_post.id,
|
||||||
author: db_author,
|
author: db_author,
|
||||||
|
|
Loading…
Reference in a new issue