diff options
Diffstat (limited to 'server/models/account/user.ts')
-rw-r--r-- | server/models/account/user.ts | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/server/models/account/user.ts b/server/models/account/user.ts index d7e09e328..4226bcb35 100644 --- a/server/models/account/user.ts +++ b/server/models/account/user.ts | |||
@@ -4,6 +4,7 @@ import { | |||
4 | Scopes, Table, UpdatedAt | 4 | Scopes, Table, UpdatedAt |
5 | } from 'sequelize-typescript' | 5 | } from 'sequelize-typescript' |
6 | import { hasUserRight, USER_ROLE_LABELS, UserRight } from '../../../shared' | 6 | import { hasUserRight, USER_ROLE_LABELS, UserRight } from '../../../shared' |
7 | import { User } from '../../../shared/models/users' | ||
7 | import { | 8 | import { |
8 | isUserAutoPlayVideoValid, isUserDisplayNSFWValid, isUserPasswordValid, isUserRoleValid, isUserUsernameValid, | 9 | isUserAutoPlayVideoValid, isUserDisplayNSFWValid, isUserPasswordValid, isUserRoleValid, isUserUsernameValid, |
9 | isUserVideoQuotaValid | 10 | isUserVideoQuotaValid |
@@ -210,7 +211,7 @@ export class UserModel extends Model<UserModel> { | |||
210 | return comparePassword(password, this.password) | 211 | return comparePassword(password, this.password) |
211 | } | 212 | } |
212 | 213 | ||
213 | toFormattedJSON () { | 214 | toFormattedJSON (): User { |
214 | const json = { | 215 | const json = { |
215 | id: this.id, | 216 | id: this.id, |
216 | username: this.username, | 217 | username: this.username, |
@@ -221,11 +222,12 @@ export class UserModel extends Model<UserModel> { | |||
221 | roleLabel: USER_ROLE_LABELS[ this.role ], | 222 | roleLabel: USER_ROLE_LABELS[ this.role ], |
222 | videoQuota: this.videoQuota, | 223 | videoQuota: this.videoQuota, |
223 | createdAt: this.createdAt, | 224 | createdAt: this.createdAt, |
224 | account: this.Account.toFormattedJSON() | 225 | account: this.Account.toFormattedJSON(), |
226 | videoChannels: [] | ||
225 | } | 227 | } |
226 | 228 | ||
227 | if (Array.isArray(this.Account.VideoChannels) === true) { | 229 | if (Array.isArray(this.Account.VideoChannels) === true) { |
228 | json['videoChannels'] = this.Account.VideoChannels | 230 | json.videoChannels = this.Account.VideoChannels |
229 | .map(c => c.toFormattedJSON()) | 231 | .map(c => c.toFormattedJSON()) |
230 | .sort((v1, v2) => { | 232 | .sort((v1, v2) => { |
231 | if (v1.createdAt < v2.createdAt) return -1 | 233 | if (v1.createdAt < v2.createdAt) return -1 |