diff --git a/components/stashes/heart.vue b/components/stashes/heart.vue index fe3831a..bd72961 100644 --- a/components/stashes/heart.vue +++ b/components/stashes/heart.vue @@ -41,6 +41,8 @@ const itemAlerts = ref(props.item.alerts); const itemAlerted = ref(props.item.alerts?.only.length > 0); const hasSecondaryStash = computed(() => itemStashes.value.some((itemStash) => !itemStash.isPrimary)); +// console.log(props.item); + const done = ref(true); const stashMenuDropdownId = useId(); const stashTogglesDropdownId = useId(); diff --git a/config/default.cjs b/config/default.cjs index e5faa7e..8846dd8 100755 --- a/config/default.cjs +++ b/config/default.cjs @@ -206,6 +206,6 @@ module.exports = { // Resend enabled: false, apiKey: null, - from: 'noreply@alerts.traxxx.me', + from: 'traxxx ', }, }; diff --git a/src/actors.js b/src/actors.js index 5406646..4065c1a 100644 --- a/src/actors.js +++ b/src/actors.js @@ -304,18 +304,18 @@ export async function fetchActorsById(actorIds, options = {}, reqUser) { .orderBy(knex.raw('max(actors_avatars.created_at)'), 'desc'), knex('actors_socials') .whereIn('actor_id', actorIds), - reqUser + reqUser && !options.shallow ? knex('stashes_actors') .leftJoin('stashes', 'stashes.id', 'stashes_actors.stash_id') .where('stashes.user_id', reqUser.id) .whereIn('stashes_actors.actor_id', actorIds) : [], - reqUser + reqUser && !options.shallow ? knex('alerts_users_actors') .where('user_id', reqUser.id) .whereIn('actor_id', actorIds) : [], - ].slice(0, options.shallow ? 1 : -1)); + ].slice(0, options.shallow ? 1 : undefined)); if (options.order) { return actors.map((actorEntry) => curateActor(actorEntry, { diff --git a/src/alerts.js b/src/alerts.js index ee25f65..57ba7c7 100755 --- a/src/alerts.js +++ b/src/alerts.js @@ -262,7 +262,7 @@ export async function createAlert(alert, reqUser) { entityIds?.length > 0 && knex('alerts_entities').insert(entityIds.map((entityId) => ({ alert_id: alertId, entity_id: entityId, - })).slice(0, alert.allEntities ? 1 : Infinity)), // one scene can never match multiple entities in AND mode + })).slice(0, alert.allEntities ? 1 : undefined)), // one scene can never match multiple entities in AND mode sceneIds?.length > 0 && knex('alerts_scenes').insert(sceneIds.map((sceneId) => ({ alert_id: alertId, scene_id: sceneId, @@ -847,7 +847,13 @@ async function alertSceneReleases() { .update('is_expired', true); await trx.commit(); - await knex.schema.refreshMaterializedView('alerts_users_scenes'); + + await Promise.all([ + knex.schema.refreshMaterializedView('alerts_users_actors'), + knex.schema.refreshMaterializedView('alerts_users_tags'), + knex.schema.refreshMaterializedView('alerts_users_entities'), + knex.schema.refreshMaterializedView('alerts_users_scenes'), + ]); } catch (error) { await trx.rollback(); @@ -877,7 +883,12 @@ async function purgeExpiredAlerts() { ) .delete(); - await knex.schema.refreshMaterializedView('alerts_users_scenes'); + await Promise.all([ + knex.schema.refreshMaterializedView('alerts_users_actors'), + knex.schema.refreshMaterializedView('alerts_users_tags'), + knex.schema.refreshMaterializedView('alerts_users_entities'), + knex.schema.refreshMaterializedView('alerts_users_scenes'), + ]); logger.info(`Purged ${purgedNotifications} notifications and ${purgedAlerts} alerts`); }