From f932957b2e33da0b6d9a29dd98281b28f220a77a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 28 Jul 2023 11:28:07 +0200 Subject: [PATCH] Remove banner/avatar fields from channel/account Deprecated since 4.2 --- .../shared/shared-main/account/actor.model.ts | 3 --- .../video-channel/video-channel.model.ts | 3 --- .../shared/shared-main/video/video.model.ts | 6 ------ server/controllers/api/users/me.ts | 3 --- server/controllers/api/video-channel.ts | 5 ----- .../shared/object-to-model-attributes.ts | 2 +- server/lib/activitypub/context.ts | 3 --- server/models/account/account.ts | 5 +---- server/models/actor/actor.ts | 21 ++++--------------- server/models/video/video-channel.ts | 10 ++------- server/tests/api/search/search-index.ts | 12 ----------- .../models/activitypub/activitypub-actor.ts | 3 --- shared/models/actors/account.model.ts | 3 --- shared/models/actors/actor.model.ts | 3 --- .../videos/channel/video-channel.model.ts | 6 ------ 15 files changed, 8 insertions(+), 80 deletions(-) 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 77bf9171b..bce040970 100644 --- a/client/src/app/shared/shared-main/account/actor.model.ts +++ b/client/src/app/shared/shared-main/account/actor.model.ts @@ -13,9 +13,6 @@ export abstract class Actor implements ServerActor { createdAt: Date | string - // TODO: remove, deprecated in 4.2 - avatar: never - avatars: ActorImage[] isLocal: boolean 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 62bd94349..db3e4b43f 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 @@ -12,9 +12,6 @@ export class VideoChannel extends Actor implements ServerVideoChannel { nameWithHost: string nameWithHostForced: string - // TODO: remove, deprecated in 4.2 - banner: never - banners: ActorImage[] bannerUrl: string 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 392dcadd0..1d077a613 100644 --- a/client/src/app/shared/shared-main/video/video.model.ts +++ b/client/src/app/shared/shared-main/video/video.model.ts @@ -86,9 +86,6 @@ export class Video implements VideoServerModel { url: string host: string - // TODO: remove, deprecated in 4.2 - avatar: ActorImage - avatars: ActorImage[] } @@ -99,9 +96,6 @@ export class Video implements VideoServerModel { url: string host: string - // TODO: remove, deprecated in 4.2 - avatar: ActorImage - avatars: ActorImage[] } diff --git a/server/controllers/api/users/me.ts b/server/controllers/api/users/me.ts index 4753308e8..26811136e 100644 --- a/server/controllers/api/users/me.ts +++ b/server/controllers/api/users/me.ts @@ -1,7 +1,6 @@ import 'multer' import express from 'express' import { auditLoggerFactory, getAuditIdFromRes, UserAuditView } from '@server/helpers/audit-logger' -import { getBiggestActorImage } from '@server/lib/actor-image' import { Hooks } from '@server/lib/plugins/hooks' import { pick } from '@shared/core-utils' import { ActorImageType, HttpStatusCode, UserUpdateMe, UserVideoQuota, UserVideoRate as FormattedUserVideoRate } from '@shared/models' @@ -264,8 +263,6 @@ async function updateMyAvatar (req: express.Request, res: express.Response) { ) return res.json({ - // TODO: remove, deprecated in 4.2 - avatar: getBiggestActorImage(avatars).toFormattedJSON(), avatars: avatars.map(avatar => avatar.toFormattedJSON()) }) } diff --git a/server/controllers/api/video-channel.ts b/server/controllers/api/video-channel.ts index 3d7ef31ee..18de5bf6a 100644 --- a/server/controllers/api/video-channel.ts +++ b/server/controllers/api/video-channel.ts @@ -1,6 +1,5 @@ import express from 'express' import { pickCommonVideoQuery } from '@server/helpers/query' -import { getBiggestActorImage } from '@server/lib/actor-image' import { Hooks } from '@server/lib/plugins/hooks' import { ActorFollowModel } from '@server/models/actor/actor-follow' import { getServerActor } from '@server/models/application/application' @@ -213,8 +212,6 @@ async function updateVideoChannelBanner (req: express.Request, res: express.Resp auditLogger.update(getAuditIdFromRes(res), new VideoChannelAuditView(videoChannel.toFormattedJSON()), oldVideoChannelAuditKeys) return res.json({ - // TODO: remove, deprecated in 4.2 - banner: getBiggestActorImage(banners).toFormattedJSON(), banners: banners.map(b => b.toFormattedJSON()) }) } @@ -228,8 +225,6 @@ async function updateVideoChannelAvatar (req: express.Request, res: express.Resp auditLogger.update(getAuditIdFromRes(res), new VideoChannelAuditView(videoChannel.toFormattedJSON()), oldVideoChannelAuditKeys) return res.json({ - // TODO: remove, deprecated in 4.2 - avatar: getBiggestActorImage(avatars).toFormattedJSON(), avatars: avatars.map(a => a.toFormattedJSON()) }) } diff --git a/server/lib/activitypub/actors/shared/object-to-model-attributes.ts b/server/lib/activitypub/actors/shared/object-to-model-attributes.ts index d854bf2b5..3ce332681 100644 --- a/server/lib/activitypub/actors/shared/object-to-model-attributes.ts +++ b/server/lib/activitypub/actors/shared/object-to-model-attributes.ts @@ -32,7 +32,7 @@ function getActorAttributesFromObject ( function getImagesInfoFromObject (actorObject: ActivityPubActor, type: ActorImageType) { const iconsOrImages = type === ActorImageType.AVATAR - ? actorObject.icons || actorObject.icon + ? actorObject.icon : actorObject.image return normalizeIconOrImage(iconsOrImages) diff --git a/server/lib/activitypub/context.ts b/server/lib/activitypub/context.ts index eba6d636d..87eb498a3 100644 --- a/server/lib/activitypub/context.ts +++ b/server/lib/activitypub/context.ts @@ -27,9 +27,6 @@ const contextStore: { [ id in ContextType ]: (string | { [ id: string ]: string language: 'sc:inLanguage', identifier: 'sc:identifier', - // TODO: remove in a few versions, introduced in 4.2 - icons: 'as:icon', - isLiveBroadcast: 'sc:isLiveBroadcast', liveSaveReplay: { '@type': 'sc:Boolean', diff --git a/server/models/account/account.ts b/server/models/account/account.ts index 396959352..8593f2f28 100644 --- a/server/models/account/account.ts +++ b/server/models/account/account.ts @@ -433,10 +433,7 @@ export class AccountModel extends Model>> { name: actor.name, url: actor.url, host: actor.host, - avatars: actor.avatars, - - // TODO: remove, deprecated in 4.2 - avatar: actor.avatar + avatars: actor.avatars } } diff --git a/server/models/actor/actor.ts b/server/models/actor/actor.ts index dccb47a10..e2e85f3d6 100644 --- a/server/models/actor/actor.ts +++ b/server/models/actor/actor.ts @@ -540,12 +540,7 @@ export class ActorModel extends Model>> { url: this.url, name: this.preferredUsername, host: this.getHost(), - avatars: (this.Avatars || []).map(a => a.toFormattedJSON()), - - // TODO: remove, deprecated in 4.2 - avatar: this.hasImage(ActorImageType.AVATAR) - ? this.Avatars[0].toFormattedJSON() - : undefined + avatars: (this.Avatars || []).map(a => a.toFormattedJSON()) } } @@ -559,23 +554,16 @@ export class ActorModel extends Model>> { followersCount: this.followersCount, createdAt: this.getCreatedAt(), - banners: (this.Banners || []).map(b => b.toFormattedJSON()), - - // TODO: remove, deprecated in 4.2 - banner: this.hasImage(ActorImageType.BANNER) - ? this.Banners[0].toFormattedJSON() - : undefined + banners: (this.Banners || []).map(b => b.toFormattedJSON()) } } toActivityPubObject (this: MActorAPChannel | MActorAPAccount, name: string) { - let icon: ActivityIconObject - let icons: ActivityIconObject[] + let icon: ActivityIconObject[] let image: ActivityIconObject if (this.hasImage(ActorImageType.AVATAR)) { - icon = getBiggestActorImage(this.Avatars).toActivityPubObject() - icons = this.Avatars.map(a => a.toActivityPubObject()) + icon = this.Avatars.map(a => a.toActivityPubObject()) } if (this.hasImage(ActorImageType.BANNER)) { @@ -613,7 +601,6 @@ export class ActorModel extends Model>> { published: this.getCreatedAt().toISOString(), icon, - icons, image } diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts index 19dd681a7..2c38850d7 100644 --- a/server/models/video/video-channel.ts +++ b/server/models/video/video-channel.ts @@ -779,10 +779,7 @@ export class VideoChannelModel extends Model