- context
- .send_comment_ws_message(
- &UserOperationCrud::CreateComment,
- inserted_comment.id,
- websocket_id,
- data.form_id.clone(),
- Some(local_user_view.person.id),
- recipient_ids,
- )
- .await
+ build_comment_response(
+ context,
+ inserted_comment.id,
+ Some(local_user_view),
+ self.form_id.clone(),
+ recipient_ids,
+ )
+ .await
+ }
+}
+
+pub fn check_comment_depth(comment: &Comment) -> Result<(), LemmyError> {
+ let path = &comment.path.0;
+ let length = path.split('.').count();
+ if length > MAX_COMMENT_DEPTH_LIMIT {
+ Err(LemmyErrorType::MaxCommentDepthReached)?
+ } else {
+ Ok(())