]> Untitled Git - lemmy.git/blobdiff - lemmy_db/src/views/comment_view.rs
Some API cleanup, adding site_id to site aggregates.
[lemmy.git] / lemmy_db / src / views / comment_view.rs
index 35a9038ded34991063fda8fa08f041825fb35d15..8c7584471914445333eeb4d09cdb4463889bbd5e 100644 (file)
@@ -145,6 +145,15 @@ impl CommentView {
       my_vote,
     })
   }
+
+  /// Gets the recipient user id.
+  /// If there is no parent comment, its the post creator
+  pub fn get_recipient_id(&self) -> i32 {
+    match &self.recipient {
+      Some(parent_commenter) => parent_commenter.id,
+      None => self.post.creator_id,
+    }
+  }
 }
 
 pub struct CommentQueryBuilder<'a> {