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
|
createdAt: Date | string
|
||||||
|
|
||||||
// TODO: remove, deprecated in 4.2
|
|
||||||
avatar: never
|
|
||||||
|
|
||||||
avatars: ActorImage[]
|
avatars: ActorImage[]
|
||||||
|
|
||||||
isLocal: boolean
|
isLocal: boolean
|
||||||
|
|
|
@ -12,9 +12,6 @@ export class VideoChannel extends Actor implements ServerVideoChannel {
|
||||||
nameWithHost: string
|
nameWithHost: string
|
||||||
nameWithHostForced: string
|
nameWithHostForced: string
|
||||||
|
|
||||||
// TODO: remove, deprecated in 4.2
|
|
||||||
banner: never
|
|
||||||
|
|
||||||
banners: ActorImage[]
|
banners: ActorImage[]
|
||||||
|
|
||||||
bannerUrl: string
|
bannerUrl: string
|
||||||
|
|
|
@ -86,9 +86,6 @@ export class Video implements VideoServerModel {
|
||||||
url: string
|
url: string
|
||||||
host: string
|
host: string
|
||||||
|
|
||||||
// TODO: remove, deprecated in 4.2
|
|
||||||
avatar: ActorImage
|
|
||||||
|
|
||||||
avatars: ActorImage[]
|
avatars: ActorImage[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,9 +96,6 @@ export class Video implements VideoServerModel {
|
||||||
url: string
|
url: string
|
||||||
host: string
|
host: string
|
||||||
|
|
||||||
// TODO: remove, deprecated in 4.2
|
|
||||||
avatar: ActorImage
|
|
||||||
|
|
||||||
avatars: ActorImage[]
|
avatars: ActorImage[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import 'multer'
|
import 'multer'
|
||||||
import express from 'express'
|
import express from 'express'
|
||||||
import { auditLoggerFactory, getAuditIdFromRes, UserAuditView } from '@server/helpers/audit-logger'
|
import { auditLoggerFactory, getAuditIdFromRes, UserAuditView } from '@server/helpers/audit-logger'
|
||||||
import { getBiggestActorImage } from '@server/lib/actor-image'
|
|
||||||
import { Hooks } from '@server/lib/plugins/hooks'
|
import { Hooks } from '@server/lib/plugins/hooks'
|
||||||
import { pick } from '@shared/core-utils'
|
import { pick } from '@shared/core-utils'
|
||||||
import { ActorImageType, HttpStatusCode, UserUpdateMe, UserVideoQuota, UserVideoRate as FormattedUserVideoRate } from '@shared/models'
|
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({
|
return res.json({
|
||||||
// TODO: remove, deprecated in 4.2
|
|
||||||
avatar: getBiggestActorImage(avatars).toFormattedJSON(),
|
|
||||||
avatars: avatars.map(avatar => avatar.toFormattedJSON())
|
avatars: avatars.map(avatar => avatar.toFormattedJSON())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import express from 'express'
|
import express from 'express'
|
||||||
import { pickCommonVideoQuery } from '@server/helpers/query'
|
import { pickCommonVideoQuery } from '@server/helpers/query'
|
||||||
import { getBiggestActorImage } from '@server/lib/actor-image'
|
|
||||||
import { Hooks } from '@server/lib/plugins/hooks'
|
import { Hooks } from '@server/lib/plugins/hooks'
|
||||||
import { ActorFollowModel } from '@server/models/actor/actor-follow'
|
import { ActorFollowModel } from '@server/models/actor/actor-follow'
|
||||||
import { getServerActor } from '@server/models/application/application'
|
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)
|
auditLogger.update(getAuditIdFromRes(res), new VideoChannelAuditView(videoChannel.toFormattedJSON()), oldVideoChannelAuditKeys)
|
||||||
|
|
||||||
return res.json({
|
return res.json({
|
||||||
// TODO: remove, deprecated in 4.2
|
|
||||||
banner: getBiggestActorImage(banners).toFormattedJSON(),
|
|
||||||
banners: banners.map(b => b.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)
|
auditLogger.update(getAuditIdFromRes(res), new VideoChannelAuditView(videoChannel.toFormattedJSON()), oldVideoChannelAuditKeys)
|
||||||
|
|
||||||
return res.json({
|
return res.json({
|
||||||
// TODO: remove, deprecated in 4.2
|
|
||||||
avatar: getBiggestActorImage(avatars).toFormattedJSON(),
|
|
||||||
avatars: avatars.map(a => a.toFormattedJSON())
|
avatars: avatars.map(a => a.toFormattedJSON())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ function getActorAttributesFromObject (
|
||||||
|
|
||||||
function getImagesInfoFromObject (actorObject: ActivityPubActor, type: ActorImageType) {
|
function getImagesInfoFromObject (actorObject: ActivityPubActor, type: ActorImageType) {
|
||||||
const iconsOrImages = type === ActorImageType.AVATAR
|
const iconsOrImages = type === ActorImageType.AVATAR
|
||||||
? actorObject.icons || actorObject.icon
|
? actorObject.icon
|
||||||
: actorObject.image
|
: actorObject.image
|
||||||
|
|
||||||
return normalizeIconOrImage(iconsOrImages)
|
return normalizeIconOrImage(iconsOrImages)
|
||||||
|
|
|
@ -27,9 +27,6 @@ const contextStore: { [ id in ContextType ]: (string | { [ id: string ]: string
|
||||||
language: 'sc:inLanguage',
|
language: 'sc:inLanguage',
|
||||||
identifier: 'sc:identifier',
|
identifier: 'sc:identifier',
|
||||||
|
|
||||||
// TODO: remove in a few versions, introduced in 4.2
|
|
||||||
icons: 'as:icon',
|
|
||||||
|
|
||||||
isLiveBroadcast: 'sc:isLiveBroadcast',
|
isLiveBroadcast: 'sc:isLiveBroadcast',
|
||||||
liveSaveReplay: {
|
liveSaveReplay: {
|
||||||
'@type': 'sc:Boolean',
|
'@type': 'sc:Boolean',
|
||||||
|
|
|
@ -433,10 +433,7 @@ export class AccountModel extends Model<Partial<AttributesOnly<AccountModel>>> {
|
||||||
name: actor.name,
|
name: actor.name,
|
||||||
url: actor.url,
|
url: actor.url,
|
||||||
host: actor.host,
|
host: actor.host,
|
||||||
avatars: actor.avatars,
|
avatars: actor.avatars
|
||||||
|
|
||||||
// TODO: remove, deprecated in 4.2
|
|
||||||
avatar: actor.avatar
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -540,12 +540,7 @@ export class ActorModel extends Model<Partial<AttributesOnly<ActorModel>>> {
|
||||||
url: this.url,
|
url: this.url,
|
||||||
name: this.preferredUsername,
|
name: this.preferredUsername,
|
||||||
host: this.getHost(),
|
host: this.getHost(),
|
||||||
avatars: (this.Avatars || []).map(a => a.toFormattedJSON()),
|
avatars: (this.Avatars || []).map(a => a.toFormattedJSON())
|
||||||
|
|
||||||
// TODO: remove, deprecated in 4.2
|
|
||||||
avatar: this.hasImage(ActorImageType.AVATAR)
|
|
||||||
? this.Avatars[0].toFormattedJSON()
|
|
||||||
: undefined
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -559,23 +554,16 @@ export class ActorModel extends Model<Partial<AttributesOnly<ActorModel>>> {
|
||||||
followersCount: this.followersCount,
|
followersCount: this.followersCount,
|
||||||
createdAt: this.getCreatedAt(),
|
createdAt: this.getCreatedAt(),
|
||||||
|
|
||||||
banners: (this.Banners || []).map(b => b.toFormattedJSON()),
|
banners: (this.Banners || []).map(b => b.toFormattedJSON())
|
||||||
|
|
||||||
// TODO: remove, deprecated in 4.2
|
|
||||||
banner: this.hasImage(ActorImageType.BANNER)
|
|
||||||
? this.Banners[0].toFormattedJSON()
|
|
||||||
: undefined
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
toActivityPubObject (this: MActorAPChannel | MActorAPAccount, name: string) {
|
toActivityPubObject (this: MActorAPChannel | MActorAPAccount, name: string) {
|
||||||
let icon: ActivityIconObject
|
let icon: ActivityIconObject[]
|
||||||
let icons: ActivityIconObject[]
|
|
||||||
let image: ActivityIconObject
|
let image: ActivityIconObject
|
||||||
|
|
||||||
if (this.hasImage(ActorImageType.AVATAR)) {
|
if (this.hasImage(ActorImageType.AVATAR)) {
|
||||||
icon = getBiggestActorImage(this.Avatars).toActivityPubObject()
|
icon = this.Avatars.map(a => a.toActivityPubObject())
|
||||||
icons = this.Avatars.map(a => a.toActivityPubObject())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.hasImage(ActorImageType.BANNER)) {
|
if (this.hasImage(ActorImageType.BANNER)) {
|
||||||
|
@ -613,7 +601,6 @@ export class ActorModel extends Model<Partial<AttributesOnly<ActorModel>>> {
|
||||||
published: this.getCreatedAt().toISOString(),
|
published: this.getCreatedAt().toISOString(),
|
||||||
|
|
||||||
icon,
|
icon,
|
||||||
icons,
|
|
||||||
|
|
||||||
image
|
image
|
||||||
}
|
}
|
||||||
|
|
|
@ -779,10 +779,7 @@ export class VideoChannelModel extends Model<Partial<AttributesOnly<VideoChannel
|
||||||
displayName: this.getDisplayName(),
|
displayName: this.getDisplayName(),
|
||||||
url: actor.url,
|
url: actor.url,
|
||||||
host: actor.host,
|
host: actor.host,
|
||||||
avatars: actor.avatars,
|
avatars: actor.avatars
|
||||||
|
|
||||||
// TODO: remove, deprecated in 4.2
|
|
||||||
avatar: actor.avatar
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -821,10 +818,7 @@ export class VideoChannelModel extends Model<Partial<AttributesOnly<VideoChannel
|
||||||
viewsPerDay,
|
viewsPerDay,
|
||||||
totalViews,
|
totalViews,
|
||||||
|
|
||||||
avatars: actor.avatars,
|
avatars: actor.avatars
|
||||||
|
|
||||||
// TODO: remove, deprecated in 4.2
|
|
||||||
avatar: actor.avatar
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.Account) videoChannel.ownerAccount = this.Account.toFormattedJSON()
|
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.host).to.equal('framatube.org')
|
||||||
expect(video.account.name).to.equal('framasoft')
|
expect(video.account.name).to.equal('framasoft')
|
||||||
expect(video.account.url).to.equal('https://framatube.org/accounts/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.account.avatars.length).to.equal(2, 'Account should have one avatar image')
|
||||||
|
|
||||||
expect(video.channel.host).to.equal('framatube.org')
|
expect(video.channel.host).to.equal('framatube.org')
|
||||||
expect(video.channel.name).to.equal('joinpeertube')
|
expect(video.channel.name).to.equal('joinpeertube')
|
||||||
expect(video.channel.url).to.equal('https://framatube.org/video-channels/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')
|
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]
|
const videoChannel = body.data[0]
|
||||||
expect(videoChannel.url).to.equal('https://framatube.org/video-channels/bf54d359-cfad-4935-9d45-9d6be93f63e8')
|
expect(videoChannel.url).to.equal('https://framatube.org/video-channels/bf54d359-cfad-4935-9d45-9d6be93f63e8')
|
||||||
expect(videoChannel.host).to.equal('framatube.org')
|
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.avatars.length).to.equal(2, 'Channel should have two avatar images')
|
||||||
expect(videoChannel.displayName).to.exist
|
expect(videoChannel.displayName).to.exist
|
||||||
|
|
||||||
expect(videoChannel.ownerAccount.url).to.equal('https://framatube.org/accounts/framasoft')
|
expect(videoChannel.ownerAccount.url).to.equal('https://framatube.org/accounts/framasoft')
|
||||||
expect(videoChannel.ownerAccount.name).to.equal('framasoft')
|
expect(videoChannel.ownerAccount.name).to.equal('framasoft')
|
||||||
expect(videoChannel.ownerAccount.host).to.equal('framatube.org')
|
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')
|
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.url).to.equal('https://peertube2.cpy.re/accounts/chocobozzz')
|
||||||
expect(videoPlaylist.ownerAccount.name).to.equal('chocobozzz')
|
expect(videoPlaylist.ownerAccount.name).to.equal('chocobozzz')
|
||||||
expect(videoPlaylist.ownerAccount.host).to.equal('peertube2.cpy.re')
|
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.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.url).to.equal('https://peertube2.cpy.re/video-channels/chocobozzz_channel')
|
||||||
expect(videoPlaylist.videoChannel.name).to.equal('chocobozzz_channel')
|
expect(videoPlaylist.videoChannel.name).to.equal('chocobozzz_channel')
|
||||||
expect(videoPlaylist.videoChannel.host).to.equal('peertube2.cpy.re')
|
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')
|
expect(videoPlaylist.videoChannel.avatars.length).to.equal(2, 'Channel should have two avatar images')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,10 +28,7 @@ export interface ActivityPubActor {
|
||||||
}
|
}
|
||||||
|
|
||||||
image?: ActivityIconObject | ActivityIconObject[]
|
image?: ActivityIconObject | ActivityIconObject[]
|
||||||
|
|
||||||
icon?: ActivityIconObject | ActivityIconObject[]
|
icon?: ActivityIconObject | ActivityIconObject[]
|
||||||
// TODO: migrate to `icon`, introduced in 4.2
|
|
||||||
icons?: ActivityIconObject[]
|
|
||||||
|
|
||||||
published?: string
|
published?: string
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,4 @@ export interface AccountSummary {
|
||||||
host: string
|
host: string
|
||||||
|
|
||||||
avatars: ActorImage[]
|
avatars: ActorImage[]
|
||||||
|
|
||||||
// TODO: remove, deprecated in 4.2
|
|
||||||
avatar: ActorImage
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,4 @@ export interface Actor {
|
||||||
createdAt: Date | string
|
createdAt: Date | string
|
||||||
|
|
||||||
avatars: ActorImage[]
|
avatars: ActorImage[]
|
||||||
|
|
||||||
// TODO: remove, deprecated in 4.2
|
|
||||||
avatar: ActorImage
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,9 +21,6 @@ export interface VideoChannel extends Actor {
|
||||||
totalViews?: number
|
totalViews?: number
|
||||||
|
|
||||||
banners: ActorImage[]
|
banners: ActorImage[]
|
||||||
|
|
||||||
// TODO: remove, deprecated in 4.2
|
|
||||||
banner: ActorImage
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface VideoChannelSummary {
|
export interface VideoChannelSummary {
|
||||||
|
@ -34,7 +31,4 @@ export interface VideoChannelSummary {
|
||||||
host: string
|
host: string
|
||||||
|
|
||||||
avatars: ActorImage[]
|
avatars: ActorImage[]
|
||||||
|
|
||||||
// TODO: remove, deprecated in 4.2
|
|
||||||
avatar: ActorImage
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue