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 de7c9550..d5ac551d 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 @@ -137,23 +137,47 @@ data_kv: post_comment_do, log_lvl: log_lvl }) + .then(function (post_comment_obj_create_result) { + if (!post_comment_obj_create_result) { + console.log('The result was null or false.'); + return false; + } else { + if (log_lvl) { + console.log('post_comment_obj_create_result:', post_comment_obj_create_result); + } + + $idaa_slct.post_comment_id = post_comment_obj_create_result.post_comment_id; + $idaa_slct.post_comment_obj = post_comment_obj_create_result; + + if ($ae_loc.site_cfg_json?.bb_send_staff_new_email) { + send_staff_notification_email(post_comment_obj_create_result); + } + } + + return post_comment_obj_create_result; + }) .catch(function (error: any) { console.log('Something went wrong.'); console.log(error); return false; + }) + .finally(() => { + disable_submit_btn = false; + $idaa_sess.bb.show__inline_edit__post_comment_id = false; }); - if (prom_api__post_comment_obj) { - $idaa_slct.post_comment_id = prom_api__post_comment_obj.post_comment_id; - $idaa_slct.post_comment_obj = prom_api__post_comment_obj; - disable_submit_btn = false; - $idaa_sess.bb.show__inline_edit__post_comment_id = false; + if (prom_api__post_comment_obj) { + // $idaa_slct.post_comment_id = prom_api__post_comment_obj.post_comment_id; + // $idaa_slct.post_comment_obj = prom_api__post_comment_obj; + + // disable_submit_btn = false; + // $idaa_sess.bb.show__inline_edit__post_comment_id = false; // Send notification to staff - if ($ae_loc.site_cfg_json?.bb_send_staff_new_email) { - send_staff_notification_email(); - } + // if ($ae_loc.site_cfg_json?.bb_send_staff_new_email) { + // send_staff_notification_email(); + // } // Send notification to the original poster if ( @@ -197,9 +221,17 @@ if (!post_comment_obj_update_result) { console.log('The result was null or false.'); return false; - } + } else { + if (log_lvl) { + console.log('post_comment_obj_update_result:', post_comment_obj_update_result); + } - $idaa_slct.post_comment_obj = post_comment_obj_update_result; + $idaa_slct.post_comment_obj = post_comment_obj_update_result; + + if ($ae_loc.site_cfg_json?.bb_send_staff_update_email) { + send_staff_notification_email(post_comment_obj_update_result); + } + } return post_comment_obj_update_result; }) @@ -215,9 +247,9 @@ $idaa_sess.bb.show__inline_edit__post_comment_id = false; // if (!$ae_loc.administrator_access && $ae_loc.site_cfg_json?.bb_send_staff_update_email) { - if ($ae_loc.site_cfg_json?.bb_send_staff_update_email) { - send_staff_notification_email(); - } + // if ($ae_loc.site_cfg_json?.bb_send_staff_update_email) { + // send_staff_notification_email(); + // } // For now we are not going to send a notification to the poster when a post comment has been updated. // if (!$ae_loc.administrator_access && $ae_loc.site_cfg_json?.bb_send_poster_email && $idaa_slct.post_obj.notify) { @@ -263,7 +295,7 @@ return prom_api__post_comment_obj; } - function send_staff_notification_email() { + function send_staff_notification_email(post_comment_do: key_val) { log_lvl = 1; if (log_lvl) { console.log( @@ -272,7 +304,7 @@ } if (log_lvl > 1) { console.log(`Selected Post Object:`, $idaa_slct.post_obj); - console.log(`Selected Post Comment Object:`, $idaa_slct.post_comment_obj); + console.log(`Selected Post Comment Object:`, post_comment_do); // console.log($lq__post_obj); // console.log($lq__post_obj?.title); @@ -290,9 +322,9 @@
A BB post has been created or updated named "${$idaa_slct.post_obj.title}".
+A BB post has been created or updated named "${post_do.title}".
Use this link to view the post.
-Copy and paste link: ${link_base_url}?post_id=${$idaa_slct.post_id}
A recovery meeting has been created or updated named "${$idaa_slct.event_obj.name}".
+A recovery meeting has been created or updated named "${event_do.name}".
Use this link to view the meeting.
- Copy and paste link: ${link_base_url}?event_id=${$idaa_slct.event_id}