More work on getting the BB ready for IDAA. Improved notification handling. Bug fixes related to creating posts and comments.

This commit is contained in:
Scott Idem
2024-11-22 14:07:27 -05:00
parent 1868adad99
commit 7ba11a104d
6 changed files with 61 additions and 13 deletions

View File

@@ -13,12 +13,20 @@ export async function load_ae_obj_id__post(
{
api_cfg,
post_id,
enabled = 'enabled',
hidden = 'not_hidden',
limit = 99,
offset = 0,
inc_comment_li = false,
try_cache = true,
log_lvl = 0
}: {
api_cfg: any,
post_id: string,
enabled?: string,
hidden?: string,
limit?: number,
offset?: number,
inc_comment_li?: boolean,
try_cache?: boolean,
log_lvl?: number
@@ -45,7 +53,8 @@ export async function load_ae_obj_id__post(
// This is expecting a list
db_save_ae_obj_li__post({
obj_type: 'post',
obj_li: [post_obj_get_result]
obj_li: [post_obj_get_result],
log_lvl: log_lvl
});
}
return post_obj_get_result;
@@ -71,6 +80,10 @@ export async function load_ae_obj_id__post(
api_cfg: api_cfg,
for_obj_type: 'post',
for_obj_id: post_id,
enabled: enabled,
hidden: hidden,
limit: limit,
offset: offset,
params: {qry__enabled: 'all', qry__limit: 25},
try_cache: try_cache,
log_lvl: log_lvl
@@ -157,7 +170,8 @@ export async function load_ae_obj_li__post(
if (try_cache) {
db_save_ae_obj_li__post({
obj_type: 'post',
obj_li: post_obj_li_get_result
obj_li: post_obj_li_get_result,
log_lvl: log_lvl
});
}
return post_obj_li_get_result;
@@ -252,7 +266,8 @@ export async function create_ae_obj__post(
db_save_ae_obj_li__post(
{
obj_type: 'post',
obj_li: [post_obj_create_result]
obj_li: [post_obj_create_result],
log_lvl: log_lvl
});
}
return post_obj_create_result;
@@ -359,7 +374,9 @@ export async function update_ae_obj__post(
if (post_obj_update_result) {
if (try_cache) {
db_save_ae_obj_li__post({
obj_type: 'post', obj_li: [post_obj_update_result]
obj_type: 'post',
obj_li: [post_obj_update_result],
log_lvl: log_lvl
});
}
return post_obj_update_result;
@@ -481,7 +498,8 @@ export async function qry__post(
if (post_obj_li_get_result) {
db_save_ae_obj_li__post({
obj_type: 'post',
obj_li: post_obj_li_get_result
obj_li: post_obj_li_get_result,
log_lvl: log_lvl
});
return post_obj_li_get_result;
} else {

View File

@@ -11,11 +11,19 @@ export async function load_ae_obj_id__post_comment(
{
api_cfg,
post_comment_id,
enabled = 'enabled',
hidden = 'not_hidden',
limit = 99,
offset = 0,
try_cache = true,
log_lvl = 0
}: {
api_cfg: any,
post_comment_id: string,
enabled?: string,
hidden?: string,
limit?: number,
offset?: number,
try_cache?: boolean,
log_lvl?: number
}
@@ -292,7 +300,8 @@ export async function update_ae_obj__post_comment(
if (post_comment_obj_update_result) {
if (try_cache) {
db_save_ae_obj_li__post_comment({
obj_type: 'post_comment', obj_li: [post_comment_obj_update_result],
obj_type: 'post_comment',
obj_li: [post_comment_obj_update_result],
log_lvl: log_lvl
});
}

View File

@@ -89,6 +89,7 @@ $: if ($idaa_trig.post_li) {
api_cfg: $ae_api,
for_obj_type: 'account',
for_obj_id: $idaa_slct.account_id,
inc_comment_li: true,
enabled: $idaa_loc.bb.qry__enabled,
hidden: $idaa_loc.bb.qry__hidden,
limit: $idaa_loc.bb.qry__limit,
@@ -97,6 +98,25 @@ $: if ($idaa_trig.post_li) {
log_lvl: log_lvl,
});
}
$: if ($idaa_trig.post_id) {
$idaa_trig.post_id = false;
if (log_lvl) {
console.log(`Triggered: $idaa_trig.post_id`);
}
$idaa_prom.load__post_obj = posts_func.load_ae_obj_id__post({
api_cfg: $ae_api,
post_id: $idaa_slct.post_id,
enabled: $idaa_loc.bb.qry__enabled,
hidden: $idaa_loc.bb.qry__hidden,
limit: $idaa_loc.bb.qry__limit,
inc_comment_li: true,
try_cache: true,
log_lvl: log_lvl,
});
}
</script>

View File

@@ -801,7 +801,7 @@ function send_staff_notification_email() {
</fieldset>
</span>
{:else}
<input type="hidden" name="enable" value={$idaa_slct.post_obj.enable} />
<!-- <input type="hidden" name="enable" value={$idaa_slct.post_obj.enable ?? false} /> -->
{/if}
</span>

View File

@@ -22,7 +22,7 @@ if ($idaa_slct.post_id) {
console.log(`Post ID selected: ${$idaa_slct.post_id}`);
console.log(`Post Object selected: ${$lq__post_obj}`);
$idaa_trig = 'load__post_obj';
$idaa_trig.post_id = $idaa_slct.post_id;
}
$: if (browser && $lq__post_obj?.post_id) {

View File

@@ -40,12 +40,13 @@ if (log_lvl) console.log('** Component Loaded: ** Post Options');
}}
class="select w-20 text-sm"
>
<option value={10}>10</option>
<option value={25}>25</option>
<option value={50}>50</option>
<option value={75}>75</option>
<option value={100}>100</option>
<option value={200}>200</option>
<option value={500}>500</option>
<option value={75} class:hidden={!$ae_loc.trusted_access}>75</option>
<option value={100} class:hidden={!$ae_loc.trusted_access}>100</option>
<option value={200} class:hidden={!$ae_loc.trusted_access}>200</option>
<option value={500} class:hidden={!$ae_loc.trusted_access}>500</option>
</select>
</span>
@@ -78,8 +79,8 @@ if (log_lvl) console.log('** Component Loaded: ** Post Options');
<button
type="button"
on:click={() => {
$idaa_loc.bb.qry__hidden = 'all';
$idaa_loc.bb.qry__enabled = 'all';
$idaa_loc.bb.qry__hidden = 'all';
$idaa_loc.bb.qry__limit = 500;
$idaa_trig.post_li = true;
}}