Enabled e-mail action in alert dialog and alerts overview action indicators.

This commit is contained in:
2026-07-18 01:02:03 +02:00
parent b6408f3244
commit 981205efaa
15 changed files with 69 additions and 53 deletions

View File

@@ -320,16 +320,22 @@ function toggleFilterCombined() {
<div class="alert-triggers"> <div class="alert-triggers">
<Icon <Icon
v-if="alert.notify && alert.isFromPreset" v-if="alert.notify && alert.isFromPreset"
v-tooltip="{ content: 'Notify in traxxx, added as quick alert', ariaId: `alert-notify-preset-${alert.id}` }" v-tooltip="{ content: alert.notify ? 'Notify in traxxx, added as quick alert' : undefined, ariaId: `alert-notify-preset-${alert.id}` }"
icon="bell-plus" icon="bell-plus"
class="trigger" class="trigger"
/> />
<Icon <Icon
v-else-if="alert.notify" v-else
v-tooltip="{ content: 'Notify in traxxx', ariaId: `alert-notify-${alert.id}` }" v-tooltip="{ content: alert.notify ? 'Notify in traxxx' : undefined, ariaId: `alert-notify-${alert.id}` }"
icon="bell2" icon="bell2"
class="trigger" :class="{ trigger: alert.notify }"
/>
<Icon
v-tooltip="'E-mail me'"
icon="envelop5"
:class="{ trigger: alert.email }"
/> />
<Icon <Icon
@@ -340,19 +346,11 @@ function toggleFilterCombined() {
/> />
<Icon <Icon
v-else-if="alert.stashes.length > 0" v-else
v-tooltip="alert.stashes.length > 0 ? { content: 'Add to Favorites', ariaId: `alert-favorites-${alert.id}` } : undefined" v-tooltip="alert.stashes.length > 0 ? { content: 'Add to Favorites', ariaId: `alert-favorites-${alert.id}` } : undefined"
icon="heart7" icon="heart7"
class="trigger" :class="{ trigger: alert.stashes.length > 0 }"
/> />
<!--
<Icon
icon="envelop5"
title="E-mail me"
:class="{ trigger: alert.email }"
/>
-->
</div> </div>
<div class="alert-actions"> <div class="alert-actions">

View File

@@ -24,7 +24,11 @@ const props = defineProps({
const emit = defineEmits(['alert', 'close']); const emit = defineEmits(['alert', 'close']);
const { assets } = inject('pageContext'); const {
assets,
user,
env,
} = inject('pageContext');
const actors = ref(props.presetActors); const actors = ref(props.presetActors);
const actorResults = ref([]); const actorResults = ref([]);
@@ -462,8 +466,10 @@ function selectStash(selectedStash) {
/> />
</label> </label>
<!-- <label
<label class="field email"> v-if="env.emailEnabled && user.email"
class="field email"
>
<span>E-mail me</span> <span>E-mail me</span>
<Checkbox <Checkbox
@@ -471,7 +477,6 @@ function selectStash(selectedStash) {
@change="(checked) => email = checked" @change="(checked) => email = checked"
/> />
</label> </label>
-->
<div class="stash"> <div class="stash">
<ul class="field-items nolist noselect"> <ul class="field-items nolist noselect">

View File

@@ -572,10 +572,10 @@ export async function notify(sceneIds) {
slug: scene.slug, slug: scene.slug,
date: scene.date, date: scene.date,
description: scene.description, description: scene.description,
actors: (actorsByReleaseId[scene.id] || []).filter(Boolean).map((actor) => ({ id: actor.actor_id, name: actor.actor_name, slug: actor.slug })), actors: (actorsByReleaseId[scene.id] || []).filter((actor) => !!actor.actor_name).map((actor) => ({ id: actor.actor_id, name: actor.actor_name, slug: actor.slug })),
actorIds: (actorsByReleaseId[scene.id] || []).map((actor) => actor.actor_id), actorIds: (actorsByReleaseId[scene.id] || []).map((actor) => actor.actor_id),
tagIds: (tagsByReleaseId[scene.id] || []).map((tag) => tag.id), tagIds: (tagsByReleaseId[scene.id] || []).map((tag) => tag.id),
tags: (tagsByReleaseId[scene.id] || []).filter(Boolean).map((tag) => ({ slug: tag.tag_slug, name: tag.tag_name })), tags: (tagsByReleaseId[scene.id] || []).filter((tag) => !!tag.tag_name).map((tag) => ({ slug: tag.tag_slug, name: tag.tag_name })),
entityId: scene.channel?.id || scene.network?.id || null, entityId: scene.channel?.id || scene.network?.id || null,
parentEntityId: scene.network?.id, parentEntityId: scene.network?.id,
posterUrl: getImagePath(scene.poster), posterUrl: getImagePath(scene.poster),

View File

@@ -14,7 +14,7 @@ function curateTemplate(template) {
}; };
} }
export function curateUser(user, _assets = {}) { export function curateUser(user, _assets = {}, reqUser) {
if (!user) { if (!user) {
return null; return null;
} }
@@ -24,13 +24,17 @@ export function curateUser(user, _assets = {}) {
const curatedUser = { const curatedUser = {
id: user.id, id: user.id,
username: user.username, username: user.username,
email: user.email,
isEmailVerified: user.email_verified, isEmailVerified: user.email_verified,
isIdentityVerified: user.identity_verified, isIdentityVerified: user.identity_verified,
avatar: `/media/avatars/${user.id}_${user.username}.png`, avatar: `/media/avatars/${user.id}_${user.username}.png`,
role: user.role, role: user.role,
abilities: [...user.role_abilities || [], ...user.abilities || []], abilities: [...user.role_abilities || [], ...user.abilities || []],
createdAt: user.created_at, createdAt: user.created_at,
...(reqUser?.id === user.id
? {
email: user.email,
}
: null),
}; };
return curatedUser; return curatedUser;
@@ -50,7 +54,7 @@ function whereUser(builder, userId, options = {}) {
builder.where('users.id', Number(userId)); builder.where('users.id', Number(userId));
} }
export async function fetchUser(userId, options = {}, _reqUser) { export async function fetchUser(userId, options = {}, reqUser) {
const user = await knex('users') const user = await knex('users')
.select(knex.raw('users.*, users_roles.abilities as role_abilities')) .select(knex.raw('users.*, users_roles.abilities as role_abilities'))
.modify((builder) => whereUser(builder, userId, options)) .modify((builder) => whereUser(builder, userId, options))
@@ -68,7 +72,7 @@ export async function fetchUser(userId, options = {}, _reqUser) {
} }
// return curateUser(user, { stashes, templates }); // return curateUser(user, { stashes, templates });
return curateUser(user, {}); return curateUser(user, {}, reqUser);
} }
export async function fetchUserTemplates(reqUser) { export async function fetchUserTemplates(reqUser) {

View File

@@ -1,3 +1,4 @@
import { stringify } from '@brillout/json-serializer/stringify';
import { Router } from 'express'; import { Router } from 'express';
import omit from 'object.omit'; import omit from 'object.omit';
@@ -44,12 +45,12 @@ export async function fetchActorsApi(req, res) {
order: req.query.order?.split('.') || ['likes', 'desc'], order: req.query.order?.split('.') || ['likes', 'desc'],
}, req.user); }, req.user);
res.send({ res.send(stringify({
actors, actors,
countries, countries,
limit, limit,
total, total,
}); }));
} }
export const actorsSchema = ` export const actorsSchema = `
@@ -188,7 +189,7 @@ export async function fetchActorsByIdGraphql(query, _req, _info) {
export async function createActorApi(req, res) { export async function createActorApi(req, res) {
const actor = await createActor(req.body.actor, omit(req.body, ['actor']), req.user); const actor = await createActor(req.body.actor, omit(req.body, ['actor']), req.user);
res.send({ actor }); res.send(stringify({ actor }));
} }
export async function mergeActorsApi(req, res) { export async function mergeActorsApi(req, res) {
@@ -199,13 +200,13 @@ export async function mergeActorsApi(req, res) {
req.user, req.user,
); );
res.send(result); res.send(stringify(result));
} }
async function fetchActorRevisionsApi(req, res) { async function fetchActorRevisionsApi(req, res) {
const revisions = await fetchActorRevisions(Number(req.params.revisionId) || null, req.query, req.user); const revisions = await fetchActorRevisions(Number(req.params.revisionId) || null, req.query, req.user);
res.send(revisions); res.send(stringify(revisions));
} }
async function createActorRevisionApi(req, res) { async function createActorRevisionApi(req, res) {

View File

@@ -1,3 +1,4 @@
import { stringify } from '@brillout/json-serializer/stringify';
import { Router } from 'express'; import { Router } from 'express';
import { import {
@@ -146,7 +147,7 @@ export const alertsSchema = `
export async function fetchAlertsApi(req, res) { export async function fetchAlertsApi(req, res) {
const alerts = await fetchAlerts(req.user); const alerts = await fetchAlerts(req.user);
res.send(alerts); res.send(stringify(alerts));
} }
export async function fetchAlertsGraphql(query, req) { export async function fetchAlertsGraphql(query, req) {
@@ -158,7 +159,7 @@ export async function fetchAlertsGraphql(query, req) {
export async function createAlertApi(req, res) { export async function createAlertApi(req, res) {
const alert = await createAlert(req.body, req.user); const alert = await createAlert(req.body, req.user);
res.send(alert); res.send(stringify(alert));
} }
export async function createAlertGraphql(query, req) { export async function createAlertGraphql(query, req) {
@@ -184,7 +185,7 @@ export async function fetchNotificationsApi(req, res) {
limit: req.query.limit || 10, limit: req.query.limit || 10,
}); });
res.send(notifications); res.send(stringify(notifications));
} }
export async function fetchNotificationsGraphql(query, req) { export async function fetchNotificationsGraphql(query, req) {

View File

@@ -67,7 +67,7 @@ export async function loginApi(req, res) {
const user = await login(req.body, req.userIp); const user = await login(req.body, req.userIp);
req.session.user = user; req.session.user = user;
res.send(user); res.send(stringify(user));
} }
export async function logoutApi(req, res) { export async function logoutApi(req, res) {
@@ -84,7 +84,7 @@ export async function signupApi(req, res) {
const user = await signup(req.body, req.userIp); const user = await signup(req.body, req.userIp);
req.session.user = user; req.session.user = user;
res.send(user); res.send(stringify(user));
} }
export async function fetchUserKeysApi(req, res) { export async function fetchUserKeysApi(req, res) {

View File

@@ -1,3 +1,4 @@
import { stringify } from '@brillout/json-serializer/stringify';
import { parseResolveInfo } from 'graphql-parse-resolve-info'; import { parseResolveInfo } from 'graphql-parse-resolve-info';
import { getIdsBySlug } from '../cache.js'; import { getIdsBySlug } from '../cache.js';
@@ -10,7 +11,7 @@ import {
export async function fetchEntitiesApi(req, res) { export async function fetchEntitiesApi(req, res) {
const entities = await fetchEntities(req.query); const entities = await fetchEntities(req.query);
res.send(entities); res.send(stringify(entities));
} }
export const entitiesSchema = ` export const entitiesSchema = `

View File

@@ -1,3 +1,5 @@
import { stringify } from '@brillout/json-serializer/stringify';
import argv from '../argv.js'; import argv from '../argv.js';
import initLogger from '../logger.js'; import initLogger from '../logger.js';
@@ -11,16 +13,16 @@ export default function errorHandler(error, req, res, _next) {
} }
if (error.httpCode) { if (error.httpCode) {
res.status(error.httpCode).send({ res.status(error.httpCode).send(stringify({
statusCode: error.httpCode, statusCode: error.httpCode,
statusMessage: error.message, statusMessage: error.message,
}); }));
return; return;
} }
res.status(500).send({ res.status(500).send(stringify({
statusCode: 500, statusCode: 500,
statusMessage: 'Oops... our server messed up. We will be investigating this incident, our apologies for the inconvenience.', statusMessage: 'Oops... our server messed up. We will be investigating this incident, our apologies for the inconvenience.',
}); }));
} }

View File

@@ -52,6 +52,7 @@ export default async function mainHandler(req, res, next) {
psa: config.psa, psa: config.psa,
links: config.links, links: config.links,
socials, socials,
emailEnabled: config.email.enabled,
captcha: { captcha: {
enabled: config.auth.captcha.enabled, enabled: config.auth.captcha.enabled,
siteKey: config.auth.captcha.siteKey, siteKey: config.auth.captcha.siteKey,

View File

@@ -53,7 +53,7 @@ export async function fetchMovieApi(req, res) {
throw new HttpError(`No movie with ID ${req.params.movieId} found`, 404); throw new HttpError(`No movie with ID ${req.params.movieId} found`, 404);
} }
res.send(movie); res.send(stringify(movie));
} }
export const moviesSchema = ` export const moviesSchema = `

View File

@@ -261,7 +261,7 @@ async function fetchSceneApi(req, res) {
throw new HttpError(`No scene with ID ${req.params.sceneId} found`, 404); throw new HttpError(`No scene with ID ${req.params.sceneId} found`, 404);
} }
res.send(scene); res.send(stringify(scene));
} }
export async function fetchScenesByIdGraphql(query, req) { export async function fetchScenesByIdGraphql(query, req) {
@@ -281,7 +281,7 @@ export async function fetchScenesByIdGraphql(query, req) {
async function fetchSceneRevisionsApi(req, res) { async function fetchSceneRevisionsApi(req, res) {
const revisions = await fetchSceneRevisions(Number(req.params.revisionId) || null, req.query, req.user); const revisions = await fetchSceneRevisions(Number(req.params.revisionId) || null, req.query, req.user);
res.send(revisions); res.send(stringify(revisions));
} }
async function createSceneRevisionApi(req, res) { async function createSceneRevisionApi(req, res) {

View File

@@ -1,3 +1,4 @@
import { stringify } from '@brillout/json-serializer/stringify';
import { Router } from 'express'; import { Router } from 'express';
import { import {
@@ -100,7 +101,7 @@ export const stashesSchema = `
export async function fetchUserStashesApi(req, res) { export async function fetchUserStashesApi(req, res) {
const stashes = await fetchUserStashes(req.user.id, req.user); const stashes = await fetchUserStashes(req.user.id, req.user);
res.send(stashes); res.send(stringify(stashes));
} }
export async function fetchUserStashesGraphql(query, req) { export async function fetchUserStashesGraphql(query, req) {
@@ -118,7 +119,7 @@ export async function fetchStashGraphql(query, req) {
export async function createStashApi(req, res) { export async function createStashApi(req, res) {
const stash = await createStash(req.body, req.user); const stash = await createStash(req.body, req.user);
res.send(stash); res.send(stringify(stash));
} }
export async function createStashGraphql(query, req) { export async function createStashGraphql(query, req) {
@@ -130,7 +131,7 @@ export async function createStashGraphql(query, req) {
export async function updateStashApi(req, res) { export async function updateStashApi(req, res) {
const stash = await updateStash(Number(req.params.stashId), req.body, req.user); const stash = await updateStash(Number(req.params.stashId), req.body, req.user);
res.send(stash); res.send(stringify(stash));
} }
export async function updateStashGraphql(query, req) { export async function updateStashGraphql(query, req) {
@@ -154,7 +155,7 @@ export async function removeStashGraphql(query, req) {
export async function stashActorApi(req, res) { export async function stashActorApi(req, res) {
const stashed = await stashActor(req.body.actorId, Number(req.params.stashId), req.user); const stashed = await stashActor(req.body.actorId, Number(req.params.stashId), req.user);
res.send(stashed); res.send(stringify(stashed));
} }
export async function stashActorGraphql(query, req) { export async function stashActorGraphql(query, req) {
@@ -166,7 +167,7 @@ export async function stashActorGraphql(query, req) {
export async function unstashActorApi(req, res) { export async function unstashActorApi(req, res) {
const unstashed = await unstashActor(Number(req.params.actorId), Number(req.params.stashId), req.user); const unstashed = await unstashActor(Number(req.params.actorId), Number(req.params.stashId), req.user);
res.send(unstashed); res.send(stringify(unstashed));
} }
export async function unstashActorGraphql(query, req) { export async function unstashActorGraphql(query, req) {
@@ -178,7 +179,7 @@ export async function unstashActorGraphql(query, req) {
export async function stashSceneApi(req, res) { export async function stashSceneApi(req, res) {
const stashed = await stashScene(req.body.sceneId, Number(req.params.stashId), req.user); const stashed = await stashScene(req.body.sceneId, Number(req.params.stashId), req.user);
res.send(stashed); res.send(stringify(stashed));
} }
export async function stashSceneGraphql(query, req) { export async function stashSceneGraphql(query, req) {
@@ -190,7 +191,7 @@ export async function stashSceneGraphql(query, req) {
export async function unstashSceneApi(req, res) { export async function unstashSceneApi(req, res) {
const unstashed = await unstashScene(Number(req.params.sceneId), Number(req.params.stashId), req.user); const unstashed = await unstashScene(Number(req.params.sceneId), Number(req.params.stashId), req.user);
res.send(unstashed); res.send(stringify(unstashed));
} }
export async function unstashSceneGraphql(query, req) { export async function unstashSceneGraphql(query, req) {
@@ -202,7 +203,7 @@ export async function unstashSceneGraphql(query, req) {
export async function stashMovieApi(req, res) { export async function stashMovieApi(req, res) {
const stashed = await stashMovie(req.body.movieId, Number(req.params.stashId), req.user); const stashed = await stashMovie(req.body.movieId, Number(req.params.stashId), req.user);
res.send(stashed); res.send(stringify(stashed));
} }
export async function stashMovieGraphql(query, req) { export async function stashMovieGraphql(query, req) {
@@ -214,7 +215,7 @@ export async function stashMovieGraphql(query, req) {
export async function unstashMovieApi(req, res) { export async function unstashMovieApi(req, res) {
const unstashed = await unstashMovie(Number(req.params.movieId), Number(req.params.stashId), req.user); const unstashed = await unstashMovie(Number(req.params.movieId), Number(req.params.stashId), req.user);
res.send(unstashed); res.send(stringify(unstashed));
} }
export async function unstashMovieGraphql(query, req) { export async function unstashMovieGraphql(query, req) {

View File

@@ -1,3 +1,5 @@
import { stringify } from '@brillout/json-serializer/stringify';
import { fetchTags } from '../tags.js'; import { fetchTags } from '../tags.js';
export async function fetchTagsApi(req, res) { export async function fetchTagsApi(req, res) {
@@ -7,5 +9,5 @@ export async function fetchTagsApi(req, res) {
restriction: req.restriction, restriction: req.restriction,
}); });
res.send(tags); res.send(stringify(tags));
} }

View File

@@ -18,7 +18,7 @@ async function fetchUserApi(req, res) {
async function fetchUserTemplatesApi(req, res) { async function fetchUserTemplatesApi(req, res) {
const templates = await fetchUserTemplates(req.user); const templates = await fetchUserTemplates(req.user);
res.send(templates); res.send(stringify(templates));
} }
async function createTemplateApi(req, res) { async function createTemplateApi(req, res) {