Remove banner/avatar fields from channel/account
Deprecated since 4.2
This commit is contained in:
parent
89aa333110
commit
f932957b2e
15 changed files with 8 additions and 80 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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[]
|
||||
}
|
||||
|
||||
|
|
|
@ -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())
|
||||
})
|
||||
}
|
||||
|
|
|
@ -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())
|
||||
})
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -433,10 +433,7 @@ export class AccountModel extends Model<Partial<AttributesOnly<AccountModel>>> {
|
|||
name: actor.name,
|
||||
url: actor.url,
|
||||
host: actor.host,
|
||||
avatars: actor.avatars,
|
||||
|
||||
// TODO: remove, deprecated in 4.2
|
||||
avatar: actor.avatar
|
||||
avatars: actor.avatars
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -540,12 +540,7 @@ export class ActorModel extends Model<Partial<AttributesOnly<ActorModel>>> {
|
|||
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<Partial<AttributesOnly<ActorModel>>> {
|
|||
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<Partial<AttributesOnly<ActorModel>>> {
|
|||
published: this.getCreatedAt().toISOString(),
|
||||
|
||||
icon,
|
||||
icons,
|
||||
|
||||
image
|
||||
}
|
||||
|
|
|
@ -779,10 +779,7 @@ export class VideoChannelModel extends Model<Partial<AttributesOnly<VideoChannel
|
|||
displayName: this.getDisplayName(),
|
||||
url: actor.url,
|
||||
host: actor.host,
|
||||
avatars: actor.avatars,
|
||||
|
||||
// TODO: remove, deprecated in 4.2
|
||||
avatar: actor.avatar
|
||||
avatars: actor.avatars
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -821,10 +818,7 @@ export class VideoChannelModel extends Model<Partial<AttributesOnly<VideoChannel
|
|||
viewsPerDay,
|
||||
totalViews,
|
||||
|
||||
avatars: actor.avatars,
|
||||
|
||||
// TODO: remove, deprecated in 4.2
|
||||
avatar: actor.avatar
|
||||
avatars: actor.avatars
|
||||
}
|
||||
|
||||
if (this.Account) videoChannel.ownerAccount = this.Account.toFormattedJSON()
|
||||
|
|
|
@ -107,15 +107,11 @@ describe('Test index search', function () {
|
|||
expect(video.account.host).to.equal('framatube.org')
|
||||
expect(video.account.name).to.equal('framasoft')
|
||||
expect(video.account.url).to.equal('https://framatube.org/accounts/framasoft')
|
||||
// TODO: remove, deprecated in 4.2
|
||||
expect(video.account.avatar).to.exist
|
||||
expect(video.account.avatars.length).to.equal(2, 'Account should have one avatar image')
|
||||
|
||||
expect(video.channel.host).to.equal('framatube.org')
|
||||
expect(video.channel.name).to.equal('joinpeertube')
|
||||
expect(video.channel.url).to.equal('https://framatube.org/video-channels/joinpeertube')
|
||||
// TODO: remove, deprecated in 4.2
|
||||
expect(video.channel.avatar).to.exist
|
||||
expect(video.channel.avatars.length).to.equal(2, 'Channel should have one avatar image')
|
||||
}
|
||||
|
||||
|
@ -293,16 +289,12 @@ describe('Test index search', function () {
|
|||
const videoChannel = body.data[0]
|
||||
expect(videoChannel.url).to.equal('https://framatube.org/video-channels/bf54d359-cfad-4935-9d45-9d6be93f63e8')
|
||||
expect(videoChannel.host).to.equal('framatube.org')
|
||||
// TODO: remove, deprecated in 4.2
|
||||
expect(videoChannel.avatar).to.exist
|
||||
expect(videoChannel.avatars.length).to.equal(2, 'Channel should have two avatar images')
|
||||
expect(videoChannel.displayName).to.exist
|
||||
|
||||
expect(videoChannel.ownerAccount.url).to.equal('https://framatube.org/accounts/framasoft')
|
||||
expect(videoChannel.ownerAccount.name).to.equal('framasoft')
|
||||
expect(videoChannel.ownerAccount.host).to.equal('framatube.org')
|
||||
// TODO: remove, deprecated in 4.2
|
||||
expect(videoChannel.ownerAccount.avatar).to.exist
|
||||
expect(videoChannel.ownerAccount.avatars.length).to.equal(2, 'Account should have two avatar images')
|
||||
}
|
||||
|
||||
|
@ -369,15 +361,11 @@ describe('Test index search', function () {
|
|||
expect(videoPlaylist.ownerAccount.url).to.equal('https://peertube2.cpy.re/accounts/chocobozzz')
|
||||
expect(videoPlaylist.ownerAccount.name).to.equal('chocobozzz')
|
||||
expect(videoPlaylist.ownerAccount.host).to.equal('peertube2.cpy.re')
|
||||
// TODO: remove, deprecated in 4.2
|
||||
expect(videoPlaylist.ownerAccount.avatar).to.exist
|
||||
expect(videoPlaylist.ownerAccount.avatars.length).to.equal(2, 'Account should have two avatar images')
|
||||
|
||||
expect(videoPlaylist.videoChannel.url).to.equal('https://peertube2.cpy.re/video-channels/chocobozzz_channel')
|
||||
expect(videoPlaylist.videoChannel.name).to.equal('chocobozzz_channel')
|
||||
expect(videoPlaylist.videoChannel.host).to.equal('peertube2.cpy.re')
|
||||
// TODO: remove, deprecated in 4.2
|
||||
expect(videoPlaylist.videoChannel.avatar).to.exist
|
||||
expect(videoPlaylist.videoChannel.avatars.length).to.equal(2, 'Channel should have two avatar images')
|
||||
}
|
||||
|
||||
|
|
|
@ -28,10 +28,7 @@ export interface ActivityPubActor {
|
|||
}
|
||||
|
||||
image?: ActivityIconObject | ActivityIconObject[]
|
||||
|
||||
icon?: ActivityIconObject | ActivityIconObject[]
|
||||
// TODO: migrate to `icon`, introduced in 4.2
|
||||
icons?: ActivityIconObject[]
|
||||
|
||||
published?: string
|
||||
}
|
||||
|
|
|
@ -19,7 +19,4 @@ export interface AccountSummary {
|
|||
host: string
|
||||
|
||||
avatars: ActorImage[]
|
||||
|
||||
// TODO: remove, deprecated in 4.2
|
||||
avatar: ActorImage
|
||||
}
|
||||
|
|
|
@ -10,7 +10,4 @@ export interface Actor {
|
|||
createdAt: Date | string
|
||||
|
||||
avatars: ActorImage[]
|
||||
|
||||
// TODO: remove, deprecated in 4.2
|
||||
avatar: ActorImage
|
||||
}
|
||||
|
|
|
@ -21,9 +21,6 @@ export interface VideoChannel extends Actor {
|
|||
totalViews?: number
|
||||
|
||||
banners: ActorImage[]
|
||||
|
||||
// TODO: remove, deprecated in 4.2
|
||||
banner: ActorImage
|
||||
}
|
||||
|
||||
export interface VideoChannelSummary {
|
||||
|
@ -34,7 +31,4 @@ export interface VideoChannelSummary {
|
|||
host: string
|
||||
|
||||
avatars: ActorImage[]
|
||||
|
||||
// TODO: remove, deprecated in 4.2
|
||||
avatar: ActorImage
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue