From e3f1ee4e335739b895bced938540c003df24af73 Mon Sep 17 00:00:00 2001 From: kontrollanten <6680299+kontrollanten@users.noreply.github.com> Date: Sat, 1 Oct 2022 17:09:40 +0200 Subject: [PATCH] fix(server/user/me): shortUUID response --- server/models/user/user.ts | 2 +- server/tests/api/users/users.ts | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/server/models/user/user.ts b/server/models/user/user.ts index 05f9c0a6b..e8d6b5232 100644 --- a/server/models/user/user.ts +++ b/server/models/user/user.ts @@ -114,7 +114,7 @@ enum ScopeNames { ] }, { - attributes: [ 'id', 'name', 'type' ], + attributes: [ 'id', 'name', 'type', 'uuid' ], model: VideoPlaylistModel.unscoped(), required: true, where: { diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts index 9e657b387..c8706c1b1 100644 --- a/server/tests/api/users/users.ts +++ b/server/tests/api/users/users.ts @@ -1,6 +1,7 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import { expect } from 'chai' +import short from 'short-uuid' import { testImage } from '@server/tests/shared' import { AbuseState, HttpStatusCode, OAuth2ErrorCode, UserAdminFlag, UserRole, VideoPlaylistType } from '@shared/models' import { @@ -12,6 +13,8 @@ import { setAccessTokensToServers } from '@shared/server-commands' +const translator = short() + describe('Test users', function () { let server: PeerTubeServer let token: string @@ -229,6 +232,7 @@ describe('Test users', function () { expect(userGet.adminFlags).to.equal(UserAdminFlag.BYPASS_VIDEO_AUTO_BLACKLIST) expect(userMe.specialPlaylists).to.have.lengthOf(1) + expect(userMe.specialPlaylists[0].shortUUID).to.have.lengthOf(translator.maxLength) expect(userMe.specialPlaylists[0].type).to.equal(VideoPlaylistType.WATCH_LATER) // Check stats are included with withStats