The notifications to Post Commenters should be working now.

This commit is contained in:
Scott Idem
2025-08-11 18:34:58 -04:00
parent 6622fc4169
commit a4b3d3887f
2 changed files with 28 additions and 9 deletions

View File

@@ -70,6 +70,17 @@ let lq__post_comment_obj_li = $derived(liveQuery(async () => {
.sortBy('updated_on');
// .sortBy('title');
if ($idaa_slct.post_comment_obj_li && JSON.stringify($idaa_slct.post_comment_obj_li) !== JSON.stringify(results)) {
$idaa_slct.post_comment_obj_li = [...results];
if (log_lvl) {
console.log(`$idaa_slct.post_comment_obj_li = `, $idaa_slct.post_comment_obj_li);
}
} else {
if (log_lvl) {
console.log(`Post comment object list has not changed for post_id: ${$idaa_slct.post_id}`);
}
}
return results;
}));

View File

@@ -125,6 +125,10 @@ async function handle_submit_form(event: any) {
if (!$idaa_slct.post_comment_id) {
if (log_lvl) {
console.log(`Current Post Comment Object List Length: ${$idaa_slct.post_comment_obj_li.length}`, $idaa_slct.post_comment_obj_li);
}
prom_api__post_comment_obj = await posts_func.create_ae_obj__post_comment({
api_cfg: $ae_api,
post_id: $idaa_slct.post_id,
@@ -168,17 +172,21 @@ async function handle_submit_form(event: any) {
}
// Send a notification to any other post commenters
console.log(`Sending notification email to post commenters...: ${$lq__post_comment_obj_li?.length}`);
if ($lq__post_comment_obj_li && $lq__post_comment_obj_li.length > 0) {
for (const post_comment of $lq__post_comment_obj_li) {
console.log('Post Comment ID:', post_comment.post_comment_id);
if (post_comment.post_comment_id !== $idaa_slct.post_comment_id) {
console.log('Sending notification email to post commenter:', post_comment.full_name);
// send_poster_commenters_notification_email({
// post_comment_obj: post_comment,
// });
if (!$ae_loc.administrator_access && $ae_loc.site_cfg_json?.bb_send_commenter_email) {
console.log(`Sending notification email to post commenters...: ${$idaa_slct.post_comment_obj_li?.length}`);
if ($idaa_slct.post_comment_obj_li && $idaa_slct.post_comment_obj_li.length > 0) {
for (const post_comment of $idaa_slct.post_comment_obj_li) {
console.log('Post Comment ID:', post_comment.post_comment_id);
if (post_comment?.email && post_comment.post_comment_id !== $idaa_slct.post_comment_id && (post_comment?.email !== $idaa_slct.post_comment_obj?.email)) {
console.log(`Sending notification email to post commenter: ${post_comment.full_name}`, post_comment);
send_poster_commenters_notification_email({
post_comment_obj: post_comment,
});
}
}
}
}
return prom_api__post_comment_obj;