From f479685678406a5df864d89615b33d29085ebfc6 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 6 Apr 2021 11:35:56 +0200 Subject: Agnostic actor image storage --- client/src/app/core/users/user.model.ts | 4 ++-- client/src/app/core/users/user.service.ts | 5 ++--- client/src/app/shared/shared-main/account/account.model.ts | 4 ++-- client/src/app/shared/shared-main/account/actor.model.ts | 4 ++-- .../src/app/shared/shared-main/video-channel/video-channel.model.ts | 4 ++-- .../app/shared/shared-main/video-channel/video-channel.service.ts | 4 ++-- client/src/app/shared/shared-main/video/video.model.ts | 6 +++--- 7 files changed, 15 insertions(+), 16 deletions(-) (limited to 'client/src/app') diff --git a/client/src/app/core/users/user.model.ts b/client/src/app/core/users/user.model.ts index 15a4f7f82..8aaaa238d 100644 --- a/client/src/app/core/users/user.model.ts +++ b/client/src/app/core/users/user.model.ts @@ -1,7 +1,7 @@ import { Account } from '@app/shared/shared-main/account/account.model' import { hasUserRight } from '@shared/core-utils/users' import { - Avatar, + ActorImage, NSFWPolicyType, User as UserServerModel, UserAdminFlag, @@ -131,7 +131,7 @@ export class User implements UserServerModel { } } - updateAccountAvatar (newAccountAvatar?: Avatar) { + updateAccountAvatar (newAccountAvatar?: ActorImage) { if (newAccountAvatar) this.account.updateAvatar(newAccountAvatar) else this.account.resetAvatar() } diff --git a/client/src/app/core/users/user.service.ts b/client/src/app/core/users/user.service.ts index 33cc1f668..3de83152c 100644 --- a/client/src/app/core/users/user.service.ts +++ b/client/src/app/core/users/user.service.ts @@ -7,8 +7,7 @@ import { AuthService } from '@app/core/auth' import { getBytes } from '@root-helpers/bytes' import { UserLocalStorageKeys } from '@root-helpers/users' import { - Avatar, - NSFWPolicyType, + ActorImage, ResultList, User as UserServerModel, UserCreate, @@ -136,7 +135,7 @@ export class UserService { changeAvatar (avatarForm: FormData) { const url = UserService.BASE_USERS_URL + 'me/avatar/pick' - return this.authHttp.post<{ avatar: Avatar }>(url, avatarForm) + return this.authHttp.post<{ avatar: ActorImage }>(url, avatarForm) .pipe(catchError(err => this.restExtractor.handleError(err))) } diff --git a/client/src/app/shared/shared-main/account/account.model.ts b/client/src/app/shared/shared-main/account/account.model.ts index b71a893d1..17fddff09 100644 --- a/client/src/app/shared/shared-main/account/account.model.ts +++ b/client/src/app/shared/shared-main/account/account.model.ts @@ -1,4 +1,4 @@ -import { Account as ServerAccount, Avatar } from '@shared/models' +import { Account as ServerAccount, ActorImage } from '@shared/models' import { Actor } from './actor.model' export class Account extends Actor implements ServerAccount { @@ -38,7 +38,7 @@ export class Account extends Actor implements ServerAccount { this.mutedServerByInstance = false } - updateAvatar (newAvatar: Avatar) { + updateAvatar (newAvatar: ActorImage) { this.avatar = newAvatar this.updateComputedAttributes() diff --git a/client/src/app/shared/shared-main/account/actor.model.ts b/client/src/app/shared/shared-main/account/actor.model.ts index 8222c9769..c105a88ac 100644 --- a/client/src/app/shared/shared-main/account/actor.model.ts +++ b/client/src/app/shared/shared-main/account/actor.model.ts @@ -1,4 +1,4 @@ -import { Actor as ActorServer, Avatar } from '@shared/models' +import { Actor as ActorServer, ActorImage } from '@shared/models' import { getAbsoluteAPIUrl } from '@app/helpers' export abstract class Actor implements ActorServer { @@ -10,7 +10,7 @@ export abstract class Actor implements ActorServer { followersCount: number createdAt: Date | string updatedAt: Date | string - avatar: Avatar + avatar: ActorImage avatarUrl: string diff --git a/client/src/app/shared/shared-main/video-channel/video-channel.model.ts b/client/src/app/shared/shared-main/video-channel/video-channel.model.ts index 126e43cea..b4c3365a9 100644 --- a/client/src/app/shared/shared-main/video-channel/video-channel.model.ts +++ b/client/src/app/shared/shared-main/video-channel/video-channel.model.ts @@ -1,4 +1,4 @@ -import { Account as ServerAccount, Avatar, VideoChannel as ServerVideoChannel, ViewsPerDate } from '@shared/models' +import { Account as ServerAccount, ActorImage, VideoChannel as ServerVideoChannel, ViewsPerDate } from '@shared/models' import { Account } from '../account/account.model' import { Actor } from '../account/actor.model' @@ -51,7 +51,7 @@ export class VideoChannel extends Actor implements ServerVideoChannel { } } - updateAvatar (newAvatar: Avatar) { + updateAvatar (newAvatar: ActorImage) { this.avatar = newAvatar this.updateComputedAttributes() diff --git a/client/src/app/shared/shared-main/video-channel/video-channel.service.ts b/client/src/app/shared/shared-main/video-channel/video-channel.service.ts index eff3fad4d..3f9ef74fa 100644 --- a/client/src/app/shared/shared-main/video-channel/video-channel.service.ts +++ b/client/src/app/shared/shared-main/video-channel/video-channel.service.ts @@ -3,7 +3,7 @@ import { catchError, map, tap } from 'rxjs/operators' import { HttpClient, HttpParams } from '@angular/common/http' import { Injectable } from '@angular/core' import { ComponentPaginationLight, RestExtractor, RestService } from '@app/core' -import { Avatar, ResultList, VideoChannel as VideoChannelServer, VideoChannelCreate, VideoChannelUpdate } from '@shared/models' +import { ActorImage, ResultList, VideoChannel as VideoChannelServer, VideoChannelCreate, VideoChannelUpdate } from '@shared/models' import { environment } from '../../../../environments/environment' import { Account } from '../account' import { AccountService } from '../account/account.service' @@ -85,7 +85,7 @@ export class VideoChannelService { changeVideoChannelAvatar (videoChannelName: string, avatarForm: FormData) { const url = VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannelName + '/avatar/pick' - return this.authHttp.post<{ avatar: Avatar }>(url, avatarForm) + return this.authHttp.post<{ avatar: ActorImage }>(url, avatarForm) .pipe(catchError(err => this.restExtractor.handleError(err))) } diff --git a/client/src/app/shared/shared-main/video/video.model.ts b/client/src/app/shared/shared-main/video/video.model.ts index adb6e884f..1c2c4a575 100644 --- a/client/src/app/shared/shared-main/video/video.model.ts +++ b/client/src/app/shared/shared-main/video/video.model.ts @@ -6,7 +6,7 @@ import { Actor } from '@app/shared/shared-main/account/actor.model' import { VideoChannel } from '@app/shared/shared-main/video-channel/video-channel.model' import { peertubeTranslate } from '@shared/core-utils/i18n' import { - Avatar, + ActorImage, ServerConfig, UserRight, Video as VideoServerModel, @@ -72,7 +72,7 @@ export class Video implements VideoServerModel { displayName: string url: string host: string - avatar?: Avatar + avatar?: ActorImage } channel: { @@ -81,7 +81,7 @@ export class Video implements VideoServerModel { displayName: string url: string host: string - avatar?: Avatar + avatar?: ActorImage } userHistory?: { -- cgit v1.2.3