diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/controllers/api/users/me.ts | 3 | ||||
-rw-r--r-- | server/controllers/api/video-channel.ts | 5 | ||||
-rw-r--r-- | server/lib/activitypub/actors/shared/object-to-model-attributes.ts | 2 | ||||
-rw-r--r-- | server/lib/activitypub/context.ts | 3 | ||||
-rw-r--r-- | server/models/account/account.ts | 5 | ||||
-rw-r--r-- | server/models/actor/actor.ts | 21 | ||||
-rw-r--r-- | server/models/video/video-channel.ts | 10 | ||||
-rw-r--r-- | server/tests/api/search/search-index.ts | 12 |
8 files changed, 8 insertions, 53 deletions
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 @@ | |||
1 | import 'multer' | 1 | import 'multer' |
2 | import express from 'express' | 2 | import express from 'express' |
3 | import { auditLoggerFactory, getAuditIdFromRes, UserAuditView } from '@server/helpers/audit-logger' | 3 | import { auditLoggerFactory, getAuditIdFromRes, UserAuditView } from '@server/helpers/audit-logger' |
4 | import { getBiggestActorImage } from '@server/lib/actor-image' | ||
5 | import { Hooks } from '@server/lib/plugins/hooks' | 4 | import { Hooks } from '@server/lib/plugins/hooks' |
6 | import { pick } from '@shared/core-utils' | 5 | import { pick } from '@shared/core-utils' |
7 | import { ActorImageType, HttpStatusCode, UserUpdateMe, UserVideoQuota, UserVideoRate as FormattedUserVideoRate } from '@shared/models' | 6 | import { ActorImageType, HttpStatusCode, UserUpdateMe, UserVideoQuota, UserVideoRate as FormattedUserVideoRate } from '@shared/models' |
@@ -264,8 +263,6 @@ async function updateMyAvatar (req: express.Request, res: express.Response) { | |||
264 | ) | 263 | ) |
265 | 264 | ||
266 | return res.json({ | 265 | return res.json({ |
267 | // TODO: remove, deprecated in 4.2 | ||
268 | avatar: getBiggestActorImage(avatars).toFormattedJSON(), | ||
269 | avatars: avatars.map(avatar => avatar.toFormattedJSON()) | 266 | avatars: avatars.map(avatar => avatar.toFormattedJSON()) |
270 | }) | 267 | }) |
271 | } | 268 | } |
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 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import { pickCommonVideoQuery } from '@server/helpers/query' | 2 | import { pickCommonVideoQuery } from '@server/helpers/query' |
3 | import { getBiggestActorImage } from '@server/lib/actor-image' | ||
4 | import { Hooks } from '@server/lib/plugins/hooks' | 3 | import { Hooks } from '@server/lib/plugins/hooks' |
5 | import { ActorFollowModel } from '@server/models/actor/actor-follow' | 4 | import { ActorFollowModel } from '@server/models/actor/actor-follow' |
6 | import { getServerActor } from '@server/models/application/application' | 5 | import { getServerActor } from '@server/models/application/application' |
@@ -213,8 +212,6 @@ async function updateVideoChannelBanner (req: express.Request, res: express.Resp | |||
213 | auditLogger.update(getAuditIdFromRes(res), new VideoChannelAuditView(videoChannel.toFormattedJSON()), oldVideoChannelAuditKeys) | 212 | auditLogger.update(getAuditIdFromRes(res), new VideoChannelAuditView(videoChannel.toFormattedJSON()), oldVideoChannelAuditKeys) |
214 | 213 | ||
215 | return res.json({ | 214 | return res.json({ |
216 | // TODO: remove, deprecated in 4.2 | ||
217 | banner: getBiggestActorImage(banners).toFormattedJSON(), | ||
218 | banners: banners.map(b => b.toFormattedJSON()) | 215 | banners: banners.map(b => b.toFormattedJSON()) |
219 | }) | 216 | }) |
220 | } | 217 | } |
@@ -228,8 +225,6 @@ async function updateVideoChannelAvatar (req: express.Request, res: express.Resp | |||
228 | auditLogger.update(getAuditIdFromRes(res), new VideoChannelAuditView(videoChannel.toFormattedJSON()), oldVideoChannelAuditKeys) | 225 | auditLogger.update(getAuditIdFromRes(res), new VideoChannelAuditView(videoChannel.toFormattedJSON()), oldVideoChannelAuditKeys) |
229 | 226 | ||
230 | return res.json({ | 227 | return res.json({ |
231 | // TODO: remove, deprecated in 4.2 | ||
232 | avatar: getBiggestActorImage(avatars).toFormattedJSON(), | ||
233 | avatars: avatars.map(a => a.toFormattedJSON()) | 228 | avatars: avatars.map(a => a.toFormattedJSON()) |
234 | }) | 229 | }) |
235 | } | 230 | } |
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 ( | |||
32 | 32 | ||
33 | function getImagesInfoFromObject (actorObject: ActivityPubActor, type: ActorImageType) { | 33 | function getImagesInfoFromObject (actorObject: ActivityPubActor, type: ActorImageType) { |
34 | const iconsOrImages = type === ActorImageType.AVATAR | 34 | const iconsOrImages = type === ActorImageType.AVATAR |
35 | ? actorObject.icons || actorObject.icon | 35 | ? actorObject.icon |
36 | : actorObject.image | 36 | : actorObject.image |
37 | 37 | ||
38 | return normalizeIconOrImage(iconsOrImages) | 38 | 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 | |||
27 | language: 'sc:inLanguage', | 27 | language: 'sc:inLanguage', |
28 | identifier: 'sc:identifier', | 28 | identifier: 'sc:identifier', |
29 | 29 | ||
30 | // TODO: remove in a few versions, introduced in 4.2 | ||
31 | icons: 'as:icon', | ||
32 | |||
33 | isLiveBroadcast: 'sc:isLiveBroadcast', | 30 | isLiveBroadcast: 'sc:isLiveBroadcast', |
34 | liveSaveReplay: { | 31 | liveSaveReplay: { |
35 | '@type': 'sc:Boolean', | 32 | '@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<Partial<AttributesOnly<AccountModel>>> { | |||
433 | name: actor.name, | 433 | name: actor.name, |
434 | url: actor.url, | 434 | url: actor.url, |
435 | host: actor.host, | 435 | host: actor.host, |
436 | avatars: actor.avatars, | 436 | avatars: actor.avatars |
437 | |||
438 | // TODO: remove, deprecated in 4.2 | ||
439 | avatar: actor.avatar | ||
440 | } | 437 | } |
441 | } | 438 | } |
442 | 439 | ||
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<Partial<AttributesOnly<ActorModel>>> { | |||
540 | url: this.url, | 540 | url: this.url, |
541 | name: this.preferredUsername, | 541 | name: this.preferredUsername, |
542 | host: this.getHost(), | 542 | host: this.getHost(), |
543 | avatars: (this.Avatars || []).map(a => a.toFormattedJSON()), | 543 | avatars: (this.Avatars || []).map(a => a.toFormattedJSON()) |
544 | |||
545 | // TODO: remove, deprecated in 4.2 | ||
546 | avatar: this.hasImage(ActorImageType.AVATAR) | ||
547 | ? this.Avatars[0].toFormattedJSON() | ||
548 | : undefined | ||
549 | } | 544 | } |
550 | } | 545 | } |
551 | 546 | ||
@@ -559,23 +554,16 @@ export class ActorModel extends Model<Partial<AttributesOnly<ActorModel>>> { | |||
559 | followersCount: this.followersCount, | 554 | followersCount: this.followersCount, |
560 | createdAt: this.getCreatedAt(), | 555 | createdAt: this.getCreatedAt(), |
561 | 556 | ||
562 | banners: (this.Banners || []).map(b => b.toFormattedJSON()), | 557 | banners: (this.Banners || []).map(b => b.toFormattedJSON()) |
563 | |||
564 | // TODO: remove, deprecated in 4.2 | ||
565 | banner: this.hasImage(ActorImageType.BANNER) | ||
566 | ? this.Banners[0].toFormattedJSON() | ||
567 | : undefined | ||
568 | } | 558 | } |
569 | } | 559 | } |
570 | 560 | ||
571 | toActivityPubObject (this: MActorAPChannel | MActorAPAccount, name: string) { | 561 | toActivityPubObject (this: MActorAPChannel | MActorAPAccount, name: string) { |
572 | let icon: ActivityIconObject | 562 | let icon: ActivityIconObject[] |
573 | let icons: ActivityIconObject[] | ||
574 | let image: ActivityIconObject | 563 | let image: ActivityIconObject |
575 | 564 | ||
576 | if (this.hasImage(ActorImageType.AVATAR)) { | 565 | if (this.hasImage(ActorImageType.AVATAR)) { |
577 | icon = getBiggestActorImage(this.Avatars).toActivityPubObject() | 566 | icon = this.Avatars.map(a => a.toActivityPubObject()) |
578 | icons = this.Avatars.map(a => a.toActivityPubObject()) | ||
579 | } | 567 | } |
580 | 568 | ||
581 | if (this.hasImage(ActorImageType.BANNER)) { | 569 | if (this.hasImage(ActorImageType.BANNER)) { |
@@ -613,7 +601,6 @@ export class ActorModel extends Model<Partial<AttributesOnly<ActorModel>>> { | |||
613 | published: this.getCreatedAt().toISOString(), | 601 | published: this.getCreatedAt().toISOString(), |
614 | 602 | ||
615 | icon, | 603 | icon, |
616 | icons, | ||
617 | 604 | ||
618 | image | 605 | image |
619 | } | 606 | } |
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<Partial<AttributesOnly<VideoChannel | |||
779 | displayName: this.getDisplayName(), | 779 | displayName: this.getDisplayName(), |
780 | url: actor.url, | 780 | url: actor.url, |
781 | host: actor.host, | 781 | host: actor.host, |
782 | avatars: actor.avatars, | 782 | avatars: actor.avatars |
783 | |||
784 | // TODO: remove, deprecated in 4.2 | ||
785 | avatar: actor.avatar | ||
786 | } | 783 | } |
787 | } | 784 | } |
788 | 785 | ||
@@ -821,10 +818,7 @@ export class VideoChannelModel extends Model<Partial<AttributesOnly<VideoChannel | |||
821 | viewsPerDay, | 818 | viewsPerDay, |
822 | totalViews, | 819 | totalViews, |
823 | 820 | ||
824 | avatars: actor.avatars, | 821 | avatars: actor.avatars |
825 | |||
826 | // TODO: remove, deprecated in 4.2 | ||
827 | avatar: actor.avatar | ||
828 | } | 822 | } |
829 | 823 | ||
830 | if (this.Account) videoChannel.ownerAccount = this.Account.toFormattedJSON() | 824 | if (this.Account) videoChannel.ownerAccount = this.Account.toFormattedJSON() |
diff --git a/server/tests/api/search/search-index.ts b/server/tests/api/search/search-index.ts index 21473b6bf..cbe628ccc 100644 --- a/server/tests/api/search/search-index.ts +++ b/server/tests/api/search/search-index.ts | |||
@@ -107,15 +107,11 @@ describe('Test index search', function () { | |||
107 | expect(video.account.host).to.equal('framatube.org') | 107 | expect(video.account.host).to.equal('framatube.org') |
108 | expect(video.account.name).to.equal('framasoft') | 108 | expect(video.account.name).to.equal('framasoft') |
109 | expect(video.account.url).to.equal('https://framatube.org/accounts/framasoft') | 109 | expect(video.account.url).to.equal('https://framatube.org/accounts/framasoft') |
110 | // TODO: remove, deprecated in 4.2 | ||
111 | expect(video.account.avatar).to.exist | ||
112 | expect(video.account.avatars.length).to.equal(2, 'Account should have one avatar image') | 110 | expect(video.account.avatars.length).to.equal(2, 'Account should have one avatar image') |
113 | 111 | ||
114 | expect(video.channel.host).to.equal('framatube.org') | 112 | expect(video.channel.host).to.equal('framatube.org') |
115 | expect(video.channel.name).to.equal('joinpeertube') | 113 | expect(video.channel.name).to.equal('joinpeertube') |
116 | expect(video.channel.url).to.equal('https://framatube.org/video-channels/joinpeertube') | 114 | expect(video.channel.url).to.equal('https://framatube.org/video-channels/joinpeertube') |
117 | // TODO: remove, deprecated in 4.2 | ||
118 | expect(video.channel.avatar).to.exist | ||
119 | expect(video.channel.avatars.length).to.equal(2, 'Channel should have one avatar image') | 115 | expect(video.channel.avatars.length).to.equal(2, 'Channel should have one avatar image') |
120 | } | 116 | } |
121 | 117 | ||
@@ -293,16 +289,12 @@ describe('Test index search', function () { | |||
293 | const videoChannel = body.data[0] | 289 | const videoChannel = body.data[0] |
294 | expect(videoChannel.url).to.equal('https://framatube.org/video-channels/bf54d359-cfad-4935-9d45-9d6be93f63e8') | 290 | expect(videoChannel.url).to.equal('https://framatube.org/video-channels/bf54d359-cfad-4935-9d45-9d6be93f63e8') |
295 | expect(videoChannel.host).to.equal('framatube.org') | 291 | expect(videoChannel.host).to.equal('framatube.org') |
296 | // TODO: remove, deprecated in 4.2 | ||
297 | expect(videoChannel.avatar).to.exist | ||
298 | expect(videoChannel.avatars.length).to.equal(2, 'Channel should have two avatar images') | 292 | expect(videoChannel.avatars.length).to.equal(2, 'Channel should have two avatar images') |
299 | expect(videoChannel.displayName).to.exist | 293 | expect(videoChannel.displayName).to.exist |
300 | 294 | ||
301 | expect(videoChannel.ownerAccount.url).to.equal('https://framatube.org/accounts/framasoft') | 295 | expect(videoChannel.ownerAccount.url).to.equal('https://framatube.org/accounts/framasoft') |
302 | expect(videoChannel.ownerAccount.name).to.equal('framasoft') | 296 | expect(videoChannel.ownerAccount.name).to.equal('framasoft') |
303 | expect(videoChannel.ownerAccount.host).to.equal('framatube.org') | 297 | expect(videoChannel.ownerAccount.host).to.equal('framatube.org') |
304 | // TODO: remove, deprecated in 4.2 | ||
305 | expect(videoChannel.ownerAccount.avatar).to.exist | ||
306 | expect(videoChannel.ownerAccount.avatars.length).to.equal(2, 'Account should have two avatar images') | 298 | expect(videoChannel.ownerAccount.avatars.length).to.equal(2, 'Account should have two avatar images') |
307 | } | 299 | } |
308 | 300 | ||
@@ -369,15 +361,11 @@ describe('Test index search', function () { | |||
369 | expect(videoPlaylist.ownerAccount.url).to.equal('https://peertube2.cpy.re/accounts/chocobozzz') | 361 | expect(videoPlaylist.ownerAccount.url).to.equal('https://peertube2.cpy.re/accounts/chocobozzz') |
370 | expect(videoPlaylist.ownerAccount.name).to.equal('chocobozzz') | 362 | expect(videoPlaylist.ownerAccount.name).to.equal('chocobozzz') |
371 | expect(videoPlaylist.ownerAccount.host).to.equal('peertube2.cpy.re') | 363 | expect(videoPlaylist.ownerAccount.host).to.equal('peertube2.cpy.re') |
372 | // TODO: remove, deprecated in 4.2 | ||
373 | expect(videoPlaylist.ownerAccount.avatar).to.exist | ||
374 | expect(videoPlaylist.ownerAccount.avatars.length).to.equal(2, 'Account should have two avatar images') | 364 | expect(videoPlaylist.ownerAccount.avatars.length).to.equal(2, 'Account should have two avatar images') |
375 | 365 | ||
376 | expect(videoPlaylist.videoChannel.url).to.equal('https://peertube2.cpy.re/video-channels/chocobozzz_channel') | 366 | expect(videoPlaylist.videoChannel.url).to.equal('https://peertube2.cpy.re/video-channels/chocobozzz_channel') |
377 | expect(videoPlaylist.videoChannel.name).to.equal('chocobozzz_channel') | 367 | expect(videoPlaylist.videoChannel.name).to.equal('chocobozzz_channel') |
378 | expect(videoPlaylist.videoChannel.host).to.equal('peertube2.cpy.re') | 368 | expect(videoPlaylist.videoChannel.host).to.equal('peertube2.cpy.re') |
379 | // TODO: remove, deprecated in 4.2 | ||
380 | expect(videoPlaylist.videoChannel.avatar).to.exist | ||
381 | expect(videoPlaylist.videoChannel.avatars.length).to.equal(2, 'Channel should have two avatar images') | 369 | expect(videoPlaylist.videoChannel.avatars.length).to.equal(2, 'Channel should have two avatar images') |
382 | } | 370 | } |
383 | 371 | ||