Fixed actor alert button malfunctioning due missing query. Refreshing alert meta views after batch processing alerts.
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -206,6 +206,6 @@ module.exports = {
|
||||
// Resend
|
||||
enabled: false,
|
||||
apiKey: null,
|
||||
from: 'noreply@alerts.traxxx.me',
|
||||
from: 'traxxx <noreply@alerts.traxxx.me>',
|
||||
},
|
||||
};
|
||||
|
||||
@@ -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, {
|
||||
|
||||
@@ -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`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user