completed Account Log

This commit is contained in:
PxlLoewe
2026-01-30 16:19:00 +01:00
parent ea8d63ce0b
commit 2154684223
8 changed files with 215 additions and 64 deletions

View File

@@ -41,6 +41,7 @@ export const getPublicUser = (
user: User,
options = {
ignorePrivacy: false,
fullLastName: false,
},
): PublicUser => {
const lastName = user.lastname
@@ -49,6 +50,17 @@ export const getPublicUser = (
.map((part) => `${part[0] || ""}.`)
.join(" ");
if (options.fullLastName) {
return {
firstname: user.firstname,
lastname: user.settingsHideLastname && !options.ignorePrivacy ? "" : user.lastname,
fullName:
`${user.firstname} ${user.settingsHideLastname && !options.ignorePrivacy ? "" : user.lastname}`.trim(),
publicId: user.publicId,
badges: user.badges,
};
}
return {
firstname: user.firstname,
lastname: user.settingsHideLastname && !options.ignorePrivacy ? "" : lastName.trim(), // Only take the first letter of each section of the last name

View File

@@ -1,12 +1,11 @@
model AuditLog {
model Penalty {
id Int @id @default(autoincrement())
userId String
createdUserId String?
reportId Int?
// Generalized action type to cover penalties and user history events
action AuditLogAction?
reason String?
type PenaltyType
reason String
until DateTime?
suspended Boolean @default(false)
@@ -19,13 +18,9 @@ model AuditLog {
Report Report? @relation(fields: [reportId], references: [id])
}
enum AuditLogAction {
// Penalty actions
enum PenaltyType {
KICK
TIME_BAN
PERMISSIONS_REVOCED
BAN
// User history events
USER_DELETED
USER_PROFILE_UPDATED
}