You've already forked obsidian-visualiser
Fix registration email and add no character friendly messages
This commit is contained in:
@@ -5,7 +5,6 @@ import { usersDataTable, usersTable } from '~/db/schema';
|
||||
import { schema } from '~/schemas/registration';
|
||||
import { checkSession, logSession } from '~/server/utils/user';
|
||||
import type { UserSession, UserSessionRequired } from '~/types/auth';
|
||||
import sendMail from '~/server/tasks/mail';
|
||||
import type { $ZodIssue } from 'zod/v4/core';
|
||||
|
||||
interface SuccessHandler
|
||||
@@ -84,7 +83,7 @@ export default defineEventHandler(async (e): Promise<Return> => {
|
||||
id: emailId, timestamp,
|
||||
}
|
||||
});
|
||||
await sendMail({
|
||||
await runTask('mail', {
|
||||
payload: {
|
||||
type: 'mail',
|
||||
to: [body.data.email],
|
||||
|
||||
@@ -16,9 +16,9 @@ export default defineEventHandler(async (e) => {
|
||||
let where: ((character: typeof characterTable._.config.columns, sql: Operators) => SQL | undefined) | undefined = undefined;
|
||||
const db = useDatabase();
|
||||
|
||||
const session = await getUserSession(e);
|
||||
if(visibility === "own")
|
||||
{
|
||||
const session = await getUserSession(e);
|
||||
if(!session.user)
|
||||
{
|
||||
setResponseStatus(e, 401);
|
||||
@@ -33,7 +33,6 @@ export default defineEventHandler(async (e) => {
|
||||
}
|
||||
else if(visibility === 'admin')
|
||||
{
|
||||
const session = await getUserSession(e);
|
||||
if(!session.user)
|
||||
{
|
||||
setResponseStatus(e, 401);
|
||||
@@ -73,7 +72,7 @@ export default defineEventHandler(async (e) => {
|
||||
people: character.people,
|
||||
level: character.level,
|
||||
aspect: character.aspect,
|
||||
notes: character.notes,
|
||||
notes: { public: character.public_notes, private: session.user?.id === character.owner ? character.private_notes : undefined },
|
||||
variables: character.variables,
|
||||
|
||||
training: character.training.reduce((p, v) => { p[v.stat] ??= {}; p[v.stat][v.level as TrainingLevel] = v.choice; return p; }, {} as Record<MainStat, Partial<Record<TrainingLevel, number>>>),
|
||||
|
||||
@@ -31,7 +31,8 @@ export default defineEventHandler(async (e) => {
|
||||
people: body.data.people!,
|
||||
level: body.data.level,
|
||||
aspect: body.data.aspect,
|
||||
notes: body.data.notes,
|
||||
public_notes: body.data.notes.public,
|
||||
private_notes: body.data.notes.private,
|
||||
variables: body.data.variables,
|
||||
visibility: body.data.visibility,
|
||||
thumbnail: body.data.thumbnail,
|
||||
|
||||
@@ -43,7 +43,7 @@ export default defineEventHandler(async (e) => {
|
||||
people: character.people,
|
||||
level: character.level,
|
||||
aspect: character.aspect,
|
||||
notes: { public: character.public_notes, private: character.private_notes },
|
||||
notes: { public: character.public_notes, private: session.user?.id === character.owner ? character.private_notes : undefined },
|
||||
variables: character.variables,
|
||||
|
||||
training: character.training.reduce((p, v) => { p[v.stat] ??= {}; p[v.stat][v.level as TrainingLevel] = v.choice; return p; }, {} as Record<MainStat, Partial<Record<TrainingLevel, number>>>),
|
||||
|
||||
Reference in New Issue
Block a user