aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video-channel.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/video/video-channel.ts')
-rw-r--r--server/models/video/video-channel.ts17
1 files changed, 16 insertions, 1 deletions
diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts
index 64130310d..e11268b2c 100644
--- a/server/models/video/video-channel.ts
+++ b/server/models/video/video-channel.ts
@@ -6,6 +6,8 @@ import { sendDeleteVideoChannel } from '../../lib/activitypub/send/send-delete'
6 6
7import { addMethodsToModel, getSort } from '../utils' 7import { addMethodsToModel, getSort } from '../utils'
8import { VideoChannelAttributes, VideoChannelInstance, VideoChannelMethods } from './video-channel-interface' 8import { VideoChannelAttributes, VideoChannelInstance, VideoChannelMethods } from './video-channel-interface'
9import { getAnnounceActivityPubUrl } from '../../lib/activitypub/url'
10import { activityPubCollection } from '../../helpers/activitypub'
9 11
10let VideoChannel: Sequelize.Model<VideoChannelInstance, VideoChannelAttributes> 12let VideoChannel: Sequelize.Model<VideoChannelInstance, VideoChannelAttributes>
11let toFormattedJSON: VideoChannelMethods.ToFormattedJSON 13let toFormattedJSON: VideoChannelMethods.ToFormattedJSON
@@ -139,6 +141,18 @@ toFormattedJSON = function (this: VideoChannelInstance) {
139} 141}
140 142
141toActivityPubObject = function (this: VideoChannelInstance) { 143toActivityPubObject = function (this: VideoChannelInstance) {
144 let sharesObject
145 if (Array.isArray(this.VideoChannelShares)) {
146 const shares: string[] = []
147
148 for (const videoChannelShare of this.VideoChannelShares) {
149 const shareUrl = getAnnounceActivityPubUrl(this.url, videoChannelShare.Account)
150 shares.push(shareUrl)
151 }
152
153 sharesObject = activityPubCollection(shares)
154 }
155
142 const json = { 156 const json = {
143 type: 'VideoChannel' as 'VideoChannel', 157 type: 'VideoChannel' as 'VideoChannel',
144 id: this.url, 158 id: this.url,
@@ -146,7 +160,8 @@ toActivityPubObject = function (this: VideoChannelInstance) {
146 content: this.description, 160 content: this.description,
147 name: this.name, 161 name: this.name,
148 published: this.createdAt.toISOString(), 162 published: this.createdAt.toISOString(),
149 updated: this.updatedAt.toISOString() 163 updated: this.updatedAt.toISOString(),
164 shares: sharesObject
150 } 165 }
151 166
152 return json 167 return json