X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Fuser%2Fuser.ts;h=672728a2a98ab81bdcf9ebfc7e23753b52bec97a;hb=4638cd713dcdd007cd7f49b9a95fa62ac7823e7c;hp=34329580bf17ed7c060a0cdcd6d32513fdb58a02;hpb=63fa260a81a8930c157b73c897fe8696a8cc90d4;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/user/user.ts b/server/models/user/user.ts index 34329580b..672728a2a 100644 --- a/server/models/user/user.ts +++ b/server/models/user/user.ts @@ -70,6 +70,7 @@ import { VideoImportModel } from '../video/video-import' import { VideoLiveModel } from '../video/video-live' import { VideoPlaylistModel } from '../video/video-playlist' import { UserNotificationSettingModel } from './user-notification-setting' +import { forceNumber } from '@shared/core-utils' enum ScopeNames { FOR_ME_API = 'FOR_ME_API', @@ -891,34 +892,36 @@ export class UserModel extends Model>> { autoPlayNextVideoPlaylist: this.autoPlayNextVideoPlaylist, videoLanguages: this.videoLanguages, - role: this.role, - roleLabel: USER_ROLE_LABELS[this.role], + role: { + id: this.role, + label: USER_ROLE_LABELS[this.role] + }, videoQuota: this.videoQuota, videoQuotaDaily: this.videoQuotaDaily, videoQuotaUsed: videoQuotaUsed !== undefined - ? parseInt(videoQuotaUsed + '', 10) + LiveQuotaStore.Instance.getLiveQuotaOf(this.id) + ? forceNumber(videoQuotaUsed) + LiveQuotaStore.Instance.getLiveQuotaOf(this.id) : undefined, videoQuotaUsedDaily: videoQuotaUsedDaily !== undefined - ? parseInt(videoQuotaUsedDaily + '', 10) + LiveQuotaStore.Instance.getLiveQuotaOf(this.id) + ? forceNumber(videoQuotaUsedDaily) + LiveQuotaStore.Instance.getLiveQuotaOf(this.id) : undefined, videosCount: videosCount !== undefined - ? parseInt(videosCount + '', 10) + ? forceNumber(videosCount) : undefined, abusesCount: abusesCount - ? parseInt(abusesCount, 10) + ? forceNumber(abusesCount) : undefined, abusesAcceptedCount: abusesAcceptedCount - ? parseInt(abusesAcceptedCount, 10) + ? forceNumber(abusesAcceptedCount) : undefined, abusesCreatedCount: abusesCreatedCount !== undefined - ? parseInt(abusesCreatedCount + '', 10) + ? forceNumber(abusesCreatedCount) : undefined, videoCommentsCount: videoCommentsCount !== undefined - ? parseInt(videoCommentsCount + '', 10) + ? forceNumber(videoCommentsCount) : undefined, noInstanceConfigWarningModal: this.noInstanceConfigWarningModal,