From 1acb94750408490ce89264f92a14aceeffe81c96 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 11 Jan 2021 13:53:08 +0100 Subject: Retrieve user by id instead of username --- client/src/app/+admin/users/user-edit/user-edit.ts | 5 ----- server/controllers/api/users/me.ts | 2 +- server/models/account/user.ts | 6 +++--- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/client/src/app/+admin/users/user-edit/user-edit.ts b/client/src/app/+admin/users/user-edit/user-edit.ts index 787f4b689..1613bb0d1 100644 --- a/client/src/app/+admin/users/user-edit/user-edit.ts +++ b/client/src/app/+admin/users/user-edit/user-edit.ts @@ -106,10 +106,5 @@ export abstract class UserEdit extends FormReactive implements OnInit { label: q.label, disabled: q.disabled })) - - console.log( - this.videoQuotaOptions, - this.videoQuotaDailyOptions - ) } } diff --git a/server/controllers/api/users/me.ts b/server/controllers/api/users/me.ts index b786d7f59..7ab089713 100644 --- a/server/controllers/api/users/me.ts +++ b/server/controllers/api/users/me.ts @@ -130,7 +130,7 @@ async function getUserVideoImports (req: express.Request, res: express.Response) async function getUserInformation (req: express.Request, res: express.Response) { // We did not load channels in res.locals.user - const user = await UserModel.loadForMeAPI(res.locals.oauth.token.user.username) + const user = await UserModel.loadForMeAPI(res.locals.oauth.token.user.id) return res.json(user.toMeFormattedJSON()) } diff --git a/server/models/account/user.ts b/server/models/account/user.ts index 11003645c..534898f96 100644 --- a/server/models/account/user.ts +++ b/server/models/account/user.ts @@ -564,17 +564,17 @@ export class UserModel extends Model { static loadByUsername (username: string): Promise { const query = { where: { - username: { [Op.iLike]: username } + username } } return UserModel.findOne(query) } - static loadForMeAPI (username: string): Promise { + static loadForMeAPI (id: number): Promise { const query = { where: { - username: { [Op.iLike]: username } + id } } -- cgit v1.2.3