Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Retrieve user by id instead of username

Chocobozzz1acb94750408
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 787f4b6899..1613bb0d1f 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 b786d7f598..7ab089713c 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 11003645c8..534898f963 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<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
}
}