X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fcontrollers%2Fapi%2Fusers%2Fmy-history.ts;h=dc915977fc556c4394a366d88efd41963b5ff15c;hb=17aa80ed016bafa3ccb071af3f86054033823284;hp=6cd782c4796faa64c877420b09fa8ed5b008e529;hpb=73471b1a52f242e86364ffb077ea6cadb3b07ae2;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/controllers/api/users/my-history.ts b/server/controllers/api/users/my-history.ts index 6cd782c47..dc915977f 100644 --- a/server/controllers/api/users/my-history.ts +++ b/server/controllers/api/users/my-history.ts @@ -7,10 +7,9 @@ import { setDefaultPagination, userHistoryRemoveValidator } from '../../../middlewares' -import { UserModel } from '../../../models/account/user' import { getFormattedObjects } from '../../../helpers/utils' import { UserVideoHistoryModel } from '../../../models/account/user-video-history' -import { sequelizeTypescript } from '../../../initializers' +import { sequelizeTypescript } from '../../../initializers/database' const myVideosHistoryRouter = express.Router() @@ -36,7 +35,7 @@ export { // --------------------------------------------------------------------------- async function listMyVideosHistory (req: express.Request, res: express.Response) { - const user: UserModel = res.locals.oauth.token.User + const user = res.locals.oauth.token.User const resultList = await UserVideoHistoryModel.listForApi(user, req.query.start, req.query.count) @@ -44,14 +43,12 @@ async function listMyVideosHistory (req: express.Request, res: express.Response) } async function removeUserHistory (req: express.Request, res: express.Response) { - const user: UserModel = res.locals.oauth.token.User + const user = res.locals.oauth.token.User const beforeDate = req.body.beforeDate || null await sequelizeTypescript.transaction(t => { - return UserVideoHistoryModel.removeHistoryBefore(user, beforeDate, t) + return UserVideoHistoryModel.removeUserHistoryBefore(user, beforeDate, t) }) - // Do not send the delete to other instances, we delete OUR copy of this video abuse - return res.type('json').status(204).end() }