]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Retrieve user by id instead of username
authorChocobozzz <me@florianbigard.com>
Mon, 11 Jan 2021 12:53:08 +0000 (13:53 +0100)
committerChocobozzz <me@florianbigard.com>
Mon, 11 Jan 2021 12:53:08 +0000 (13:53 +0100)
client/src/app/+admin/users/user-edit/user-edit.ts
server/controllers/api/users/me.ts
server/models/account/user.ts

index 787f4b689947ac39bbe922e44c9bfdfbd04232f1..1613bb0d1f921655b684cc91d44ec1c1b9ed911a 100644 (file)
@@ -106,10 +106,5 @@ export abstract class UserEdit extends FormReactive implements OnInit {
                                         label: q.label,
                                         disabled: q.disabled
                                       }))
-
-    console.log(
-      this.videoQuotaOptions,
-      this.videoQuotaDailyOptions
-    )
   }
 }
index b786d7f598fd6ff5cf59d193a25a91823f3d1bce..7ab089713c0efdcdc560dbf74c2e000d42a28f1f 100644 (file)
@@ -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())
 }
index 11003645c8d7d52456f7ac1c7c23cbbfc393c65f..534898f963e3d0e184993da49cf94ebddecdd4bb 100644 (file)
@@ -564,17 +564,17 @@ export class UserModel extends Model {
   static loadByUsername (username: string): Promise<MUserDefault> {
     const query = {
       where: {
-        username: { [Op.iLike]: username }
+        username
       }
     }
 
     return UserModel.findOne(query)
   }
 
-  static loadForMeAPI (username: string): Promise<MUserNotifSettingChannelDefault> {
+  static loadForMeAPI (id: number): Promise<MUserNotifSettingChannelDefault> {
     const query = {
       where: {
-        username: { [Op.iLike]: username }
+        id
       }
     }