mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-02 03:48:14 +03:00
Add contentiousContent support
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
import db from "external/mongo/db";
|
||||
import MigrateRecords from "./migrate";
|
||||
import { DEFAULT_USER_SETTINGS } from "server/router/api/v1/auth/auth";
|
||||
|
||||
function ConvertFn(c: any) {
|
||||
return { userID: c.id, preferences: DEFAULT_USER_SETTINGS };
|
||||
}
|
||||
|
||||
(async () => {
|
||||
await MigrateRecords(db["user-settings"], "users", ConvertFn);
|
||||
|
||||
process.exit(0);
|
||||
})();
|
||||
@@ -30,7 +30,7 @@ function ConvertFn(c: any): PublicUserDocument {
|
||||
}
|
||||
|
||||
(async () => {
|
||||
await MigrateRecords(db, "users", ConvertFn);
|
||||
await MigrateRecords(db.users, "users", ConvertFn);
|
||||
|
||||
process.exit(0);
|
||||
})();
|
||||
|
||||
@@ -76,9 +76,10 @@ export async function AddNewInvite(user: PublicUserDocument) {
|
||||
return result;
|
||||
}
|
||||
|
||||
const DEFAULT_USER_SETTINGS: UserSettings["preferences"] = {
|
||||
export const DEFAULT_USER_SETTINGS: UserSettings["preferences"] = {
|
||||
developerMode: false,
|
||||
invisible: false,
|
||||
contentiousContent: false,
|
||||
};
|
||||
|
||||
export function HashPassword(plaintext: string) {
|
||||
|
||||
@@ -51,6 +51,7 @@ router.patch(
|
||||
prValidate({
|
||||
invisible: "*boolean",
|
||||
developerMode: "*boolean",
|
||||
contentiousContent: "*boolean",
|
||||
}),
|
||||
async (req, res) => {
|
||||
const user = req[SYMBOL_TachiData]!.requestedUser!;
|
||||
@@ -58,6 +59,7 @@ router.patch(
|
||||
const preferences = {
|
||||
invisible: req.body.invisible,
|
||||
developerMode: req.body.developerMode,
|
||||
contentiousContent: req.body.contentiousContent,
|
||||
};
|
||||
|
||||
DeleteUndefinedProps(preferences);
|
||||
|
||||
Reference in New Issue
Block a user