Fixed actor alert button malfunctioning due missing query. Refreshing alert meta views after batch processing alerts.

This commit is contained in:
2026-07-21 05:54:43 +02:00
parent 097baed957
commit 17fd285d67
4 changed files with 20 additions and 7 deletions

View File

@@ -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`);
}