post::PostResponse,
utils::{check_person_block, get_interface_language, is_mod_or_admin, send_email_to_user},
};
post::PostResponse,
utils::{check_person_block, get_interface_language, is_mod_or_admin, send_email_to_user},
};
use lemmy_db_schema::{
newtypes::{CommentId, CommunityId, LocalUserId, PersonId, PostId},
source::{
use lemmy_db_schema::{
newtypes::{CommentId, CommunityId, LocalUserId, PersonId, PostId},
source::{
use lemmy_utils::{error::LemmyError, utils::mention::MentionData};
pub async fn build_comment_response(
use lemmy_utils::{error::LemmyError, utils::mention::MentionData};
pub async fn build_comment_response(
recipient_ids: Vec<LocalUserId>,
) -> Result<CommentResponse, LemmyError> {
let person_id = local_user_view.map(|l| l.person.id);
recipient_ids: Vec<LocalUserId>,
) -> Result<CommentResponse, LemmyError> {
let person_id = local_user_view.map(|l| l.person.id);
local_user_view: LocalUserView,
community_id: CommunityId,
local_user_view: LocalUserView,
community_id: CommunityId,
-) -> Result<CommunityResponse, LemmyError> {
- let is_mod_or_admin = is_mod_or_admin(context.pool(), local_user_view.person.id, community_id)
- .await
- .is_ok();
+) -> Result<Json<CommunityResponse>, LemmyError> {
+ let is_mod_or_admin =
+ is_mod_or_admin(&mut context.pool(), local_user_view.person.id, community_id)
+ .await
+ .is_ok();
-) -> Result<PostResponse, LemmyError> {
- let is_mod_or_admin = is_mod_or_admin(context.pool(), person_id, community_id)
+) -> Result<Json<PostResponse>, LemmyError> {
+ let is_mod_or_admin = is_mod_or_admin(&mut context.pool(), person_id, community_id)
.filter(|m| m.is_local(&context.settings().hostname) && m.name.ne(&person.name))
{
let mention_name = mention.name.clone();
.filter(|m| m.is_local(&context.settings().hostname) && m.name.ne(&person.name))
{
let mention_name = mention.name.clone();
if let Ok(mention_user_view) = user_view {
// TODO
// At some point, make it so you can't tag the parent creator either
if let Ok(mention_user_view) = user_view {
// TODO
// At some point, make it so you can't tag the parent creator either
// Allow this to fail softly, since comment edits might re-update or replace it
// Let the uniqueness handle this fail
// Allow this to fail softly, since comment edits might re-update or replace it
// Let the uniqueness handle this fail
// Send comment_reply to the parent commenter / poster
if let Some(parent_comment_id) = comment.parent_comment_id() {
// Send comment_reply to the parent commenter / poster
if let Some(parent_comment_id) = comment.parent_comment_id() {
// Get the parent commenter local_user
let parent_creator_id = parent_comment.creator_id;
// Only add to recipients if that person isn't blocked
// Get the parent commenter local_user
let parent_creator_id = parent_comment.creator_id;
// Only add to recipients if that person isn't blocked
// Allow this to fail softly, since comment edits might re-update or replace it
// Let the uniqueness handle this fail
// Allow this to fail softly, since comment edits might re-update or replace it
// Let the uniqueness handle this fail
} else {
// If there's no parent, its the post creator
// Only add to recipients if that person isn't blocked
} else {
// If there's no parent, its the post creator
// Only add to recipients if that person isn't blocked
// Allow this to fail softly, since comment edits might re-update or replace it
// Let the uniqueness handle this fail
// Allow this to fail softly, since comment edits might re-update or replace it
// Let the uniqueness handle this fail