aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-01-11 13:53:08 +0100
committerChocobozzz <me@florianbigard.com>2021-01-11 13:53:08 +0100
commit1acb94750408490ce89264f92a14aceeffe81c96 (patch)
treef186a1c61a88e48d3720ad68722f42a5eeab96c1
parentf8be7bae3fa70e5402bc1b32c0c4865b8b5db97e (diff)
downloadPeerTube-1acb94750408490ce89264f92a14aceeffe81c96.tar.gz
PeerTube-1acb94750408490ce89264f92a14aceeffe81c96.tar.zst
PeerTube-1acb94750408490ce89264f92a14aceeffe81c96.zip
Retrieve user by id instead of username
-rw-r--r--client/src/app/+admin/users/user-edit/user-edit.ts5
-rw-r--r--server/controllers/api/users/me.ts2
-rw-r--r--server/models/account/user.ts6
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 {
106 label: q.label, 106 label: q.label,
107 disabled: q.disabled 107 disabled: q.disabled
108 })) 108 }))
109
110 console.log(
111 this.videoQuotaOptions,
112 this.videoQuotaDailyOptions
113 )
114 } 109 }
115} 110}
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)
130 130
131async function getUserInformation (req: express.Request, res: express.Response) { 131async function getUserInformation (req: express.Request, res: express.Response) {
132 // We did not load channels in res.locals.user 132 // We did not load channels in res.locals.user
133 const user = await UserModel.loadForMeAPI(res.locals.oauth.token.user.username) 133 const user = await UserModel.loadForMeAPI(res.locals.oauth.token.user.id)
134 134
135 return res.json(user.toMeFormattedJSON()) 135 return res.json(user.toMeFormattedJSON())
136} 136}
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 {
564 static loadByUsername (username: string): Promise<MUserDefault> { 564 static loadByUsername (username: string): Promise<MUserDefault> {
565 const query = { 565 const query = {
566 where: { 566 where: {
567 username: { [Op.iLike]: username } 567 username
568 } 568 }
569 } 569 }
570 570
571 return UserModel.findOne(query) 571 return UserModel.findOne(query)
572 } 572 }
573 573
574 static loadForMeAPI (username: string): Promise<MUserNotifSettingChannelDefault> { 574 static loadForMeAPI (id: number): Promise<MUserNotifSettingChannelDefault> {
575 const query = { 575 const query = {
576 where: { 576 where: {
577 username: { [Op.iLike]: username } 577 id
578 } 578 }
579 } 579 }
580 580