Browse Source

Retrieve user by id instead of username

tags/v3.0.1
Chocobozzz 1 week ago
parent
commit
1acb947504
No known key found for this signature in database GPG Key ID: 583A612D890159BE
3 changed files with 4 additions and 9 deletions
  1. +0
    -5
      client/src/app/+admin/users/user-edit/user-edit.ts
  2. +1
    -1
      server/controllers/api/users/me.ts
  3. +3
    -3
      server/models/account/user.ts

+ 0
- 5
client/src/app/+admin/users/user-edit/user-edit.ts View 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
)
}
}

+ 1
- 1
server/controllers/api/users/me.ts View 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())
}


+ 3
- 3
server/models/account/user.ts View 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
}
}



Loading…
Cancel
Save