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 itemAlerted = ref(props.item.alerts?.only.length > 0);
|
||||||
const hasSecondaryStash = computed(() => itemStashes.value.some((itemStash) => !itemStash.isPrimary));
|
const hasSecondaryStash = computed(() => itemStashes.value.some((itemStash) => !itemStash.isPrimary));
|
||||||
|
|
||||||
|
// console.log(props.item);
|
||||||
|
|
||||||
const done = ref(true);
|
const done = ref(true);
|
||||||
const stashMenuDropdownId = useId();
|
const stashMenuDropdownId = useId();
|
||||||
const stashTogglesDropdownId = useId();
|
const stashTogglesDropdownId = useId();
|
||||||
|
|||||||
@@ -206,6 +206,6 @@ module.exports = {
|
|||||||
// Resend
|
// Resend
|
||||||
enabled: false,
|
enabled: false,
|
||||||
apiKey: null,
|
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'),
|
.orderBy(knex.raw('max(actors_avatars.created_at)'), 'desc'),
|
||||||
knex('actors_socials')
|
knex('actors_socials')
|
||||||
.whereIn('actor_id', actorIds),
|
.whereIn('actor_id', actorIds),
|
||||||
reqUser
|
reqUser && !options.shallow
|
||||||
? knex('stashes_actors')
|
? knex('stashes_actors')
|
||||||
.leftJoin('stashes', 'stashes.id', 'stashes_actors.stash_id')
|
.leftJoin('stashes', 'stashes.id', 'stashes_actors.stash_id')
|
||||||
.where('stashes.user_id', reqUser.id)
|
.where('stashes.user_id', reqUser.id)
|
||||||
.whereIn('stashes_actors.actor_id', actorIds)
|
.whereIn('stashes_actors.actor_id', actorIds)
|
||||||
: [],
|
: [],
|
||||||
reqUser
|
reqUser && !options.shallow
|
||||||
? knex('alerts_users_actors')
|
? knex('alerts_users_actors')
|
||||||
.where('user_id', reqUser.id)
|
.where('user_id', reqUser.id)
|
||||||
.whereIn('actor_id', actorIds)
|
.whereIn('actor_id', actorIds)
|
||||||
: [],
|
: [],
|
||||||
].slice(0, options.shallow ? 1 : -1));
|
].slice(0, options.shallow ? 1 : undefined));
|
||||||
|
|
||||||
if (options.order) {
|
if (options.order) {
|
||||||
return actors.map((actorEntry) => curateActor(actorEntry, {
|
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) => ({
|
entityIds?.length > 0 && knex('alerts_entities').insert(entityIds.map((entityId) => ({
|
||||||
alert_id: alertId,
|
alert_id: alertId,
|
||||||
entity_id: entityId,
|
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) => ({
|
sceneIds?.length > 0 && knex('alerts_scenes').insert(sceneIds.map((sceneId) => ({
|
||||||
alert_id: alertId,
|
alert_id: alertId,
|
||||||
scene_id: sceneId,
|
scene_id: sceneId,
|
||||||
@@ -847,7 +847,13 @@ async function alertSceneReleases() {
|
|||||||
.update('is_expired', true);
|
.update('is_expired', true);
|
||||||
|
|
||||||
await trx.commit();
|
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) {
|
catch (error) {
|
||||||
await trx.rollback();
|
await trx.rollback();
|
||||||
@@ -877,7 +883,12 @@ async function purgeExpiredAlerts() {
|
|||||||
)
|
)
|
||||||
.delete();
|
.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`);
|
logger.info(`Purged ${purgedNotifications} notifications and ${purgedAlerts} alerts`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user