From d0800f7661f13fabe7bb6f4aa0ea50764f106405 Mon Sep 17 00:00:00 2001 From: kontrollanten <6680299+kontrollanten@users.noreply.github.com> Date: Mon, 28 Feb 2022 08:34:43 +0100 Subject: Implement avatar miniatures (#4639) * client: remove unused file * refactor(client/my-actor-avatar): size from input Read size from component input instead of scss, to make it possible to use smaller avatar images when implemented. * implement avatar miniatures close #4560 * fix(test): max file size * fix(search-index): normalize res acc to avatarMini * refactor avatars to an array * client/search: resize channel avatar to 120 * refactor(client/videos): remove unused function * client(actor-avatar): set default size * fix tests and avatars full result When findOne is used only an array containting one avatar is returned. * update migration version and version notations * server/search: harmonize normalizing * Cleanup avatar miniature PR Co-authored-by: Chocobozzz --- server/tests/api/users/users-multiple-servers.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'server/tests/api/users/users-multiple-servers.ts') diff --git a/server/tests/api/users/users-multiple-servers.ts b/server/tests/api/users/users-multiple-servers.ts index 5b2bbc520..3e8b932c0 100644 --- a/server/tests/api/users/users-multiple-servers.ts +++ b/server/tests/api/users/users-multiple-servers.ts @@ -16,6 +16,7 @@ import { doubleFollow, PeerTubeServer, setAccessTokensToServers, + setDefaultChannelAvatar, waitJobs } from '@shared/server-commands' @@ -29,7 +30,7 @@ describe('Test users with multiple servers', function () { let videoUUID: string let userAccessToken: string - let userAvatarFilename: string + let userAvatarFilenames: string[] before(async function () { this.timeout(120_000) @@ -38,6 +39,7 @@ describe('Test users with multiple servers', function () { // Get the access tokens await setAccessTokensToServers(servers) + await setDefaultChannelAvatar(servers) // Server 1 and server 2 follow each other await doubleFollow(servers[0], servers[1]) @@ -97,9 +99,11 @@ describe('Test users with multiple servers', function () { await servers[0].users.updateMyAvatar({ fixture }) user = await servers[0].users.getMyInfo() - userAvatarFilename = user.account.avatar.path + userAvatarFilenames = user.account.avatars.map(({ path }) => path) - await testImage(servers[0].url, 'avatar2-resized', userAvatarFilename, '.png') + for (const avatar of user.account.avatars) { + await testImage(servers[0].url, `avatar2-resized-${avatar.width}x${avatar.width}`, avatar.path, '.png') + } await waitJobs(servers) }) @@ -129,7 +133,9 @@ describe('Test users with multiple servers', function () { expect(account.userId).to.be.undefined } - await testImage(server.url, 'avatar2-resized', account.avatar.path, '.png') + for (const avatar of account.avatars) { + await testImage(server.url, `avatar2-resized-${avatar.width}x${avatar.width}`, avatar.path, '.png') + } } }) @@ -193,7 +199,9 @@ describe('Test users with multiple servers', function () { it('Should not have actor files', async () => { for (const server of servers) { - await checkActorFilesWereRemoved(userAvatarFilename, server.internalServerNumber) + for (const userAvatarFilename of userAvatarFilenames) { + await checkActorFilesWereRemoved(userAvatarFilename, server.internalServerNumber) + } } }) -- cgit v1.2.3