diff --git a/src/routes/idaa/(idaa)/bb/[post_id]/+page.svelte b/src/routes/idaa/(idaa)/bb/[post_id]/+page.svelte index 82bdd664..e97ca58c 100644 --- a/src/routes/idaa/(idaa)/bb/[post_id]/+page.svelte +++ b/src/routes/idaa/(idaa)/bb/[post_id]/+page.svelte @@ -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; })); diff --git a/src/routes/idaa/(idaa)/bb/ae_idaa_comp__post_comment_obj_id_edit.svelte b/src/routes/idaa/(idaa)/bb/ae_idaa_comp__post_comment_obj_id_edit.svelte index 05b41ded..ab73fdb3 100644 --- a/src/routes/idaa/(idaa)/bb/ae_idaa_comp__post_comment_obj_id_edit.svelte +++ b/src/routes/idaa/(idaa)/bb/ae_idaa_comp__post_comment_obj_id_edit.svelte @@ -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;