diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-11-13 17:39:41 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-11-27 19:40:51 +0100 |
commit | 7a7724e66e4533523083e7336cd0d0c747c4a33b (patch) | |
tree | 805299eb9c6829158cd17e5a823a84a3a54d8209 /server/models/video | |
parent | 571389d43b8fc8aaf27e77c06f19b320b08dbbc9 (diff) | |
download | PeerTube-7a7724e66e4533523083e7336cd0d0c747c4a33b.tar.gz PeerTube-7a7724e66e4533523083e7336cd0d0c747c4a33b.tar.zst PeerTube-7a7724e66e4533523083e7336cd0d0c747c4a33b.zip |
Handle follow/accept
Diffstat (limited to 'server/models/video')
-rw-r--r-- | server/models/video/video-channel.ts | 7 | ||||
-rw-r--r-- | server/models/video/video-interface.ts | 17 | ||||
-rw-r--r-- | server/models/video/video.ts | 9 |
3 files changed, 10 insertions, 23 deletions
diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts index 183ff3436..919ec916d 100644 --- a/server/models/video/video-channel.ts +++ b/server/models/video/video-channel.ts | |||
@@ -9,6 +9,7 @@ import { | |||
9 | 9 | ||
10 | VideoChannelMethods | 10 | VideoChannelMethods |
11 | } from './video-channel-interface' | 11 | } from './video-channel-interface' |
12 | import { sendDeleteVideoChannel } from '../../lib/activitypub/send-request' | ||
12 | 13 | ||
13 | let VideoChannel: Sequelize.Model<VideoChannelInstance, VideoChannelAttributes> | 14 | let VideoChannel: Sequelize.Model<VideoChannelInstance, VideoChannelAttributes> |
14 | let toFormattedJSON: VideoChannelMethods.ToFormattedJSON | 15 | let toFormattedJSON: VideoChannelMethods.ToFormattedJSON |
@@ -176,11 +177,7 @@ function associate (models) { | |||
176 | 177 | ||
177 | function afterDestroy (videoChannel: VideoChannelInstance) { | 178 | function afterDestroy (videoChannel: VideoChannelInstance) { |
178 | if (videoChannel.isOwned()) { | 179 | if (videoChannel.isOwned()) { |
179 | const removeVideoChannelToFriendsParams = { | 180 | return sendDeleteVideoChannel(videoChannel, undefined) |
180 | uuid: videoChannel.uuid | ||
181 | } | ||
182 | |||
183 | // FIXME: send remove event to followers | ||
184 | } | 181 | } |
185 | 182 | ||
186 | return undefined | 183 | return undefined |
diff --git a/server/models/video/video-interface.ts b/server/models/video/video-interface.ts index a0ac43e1e..7243756d2 100644 --- a/server/models/video/video-interface.ts +++ b/server/models/video/video-interface.ts | |||
@@ -1,19 +1,12 @@ | |||
1 | import * as Sequelize from 'sequelize' | ||
2 | import * as Bluebird from 'bluebird' | 1 | import * as Bluebird from 'bluebird' |
2 | import * as Sequelize from 'sequelize' | ||
3 | import { VideoTorrentObject } from '../../../shared/models/activitypub/objects/video-torrent-object' | ||
4 | import { ResultList } from '../../../shared/models/result-list.model' | ||
5 | import { Video as FormattedVideo, VideoDetails as FormattedDetailsVideo } from '../../../shared/models/videos/video.model' | ||
3 | 6 | ||
4 | import { TagAttributes, TagInstance } from './tag-interface' | 7 | import { TagAttributes, TagInstance } from './tag-interface' |
5 | import { VideoFileAttributes, VideoFileInstance } from './video-file-interface' | ||
6 | |||
7 | // Don't use barrel, import just what we need | ||
8 | import { | ||
9 | Video as FormattedVideo, | ||
10 | VideoDetails as FormattedDetailsVideo | ||
11 | } from '../../../shared/models/videos/video.model' | ||
12 | import { RemoteVideoUpdateData } from '../../../shared/models/pods/remote-video/remote-video-update-request.model' | ||
13 | import { RemoteVideoCreateData } from '../../../shared/models/pods/remote-video/remote-video-create-request.model' | ||
14 | import { ResultList } from '../../../shared/models/result-list.model' | ||
15 | import { VideoChannelInstance } from './video-channel-interface' | 8 | import { VideoChannelInstance } from './video-channel-interface' |
16 | import { VideoTorrentObject } from '../../../shared/models/activitypub/objects/video-torrent-object' | 9 | import { VideoFileAttributes, VideoFileInstance } from './video-file-interface' |
17 | 10 | ||
18 | export namespace VideoMethods { | 11 | export namespace VideoMethods { |
19 | export type GetThumbnailName = (this: VideoInstance) => string | 12 | export type GetThumbnailName = (this: VideoInstance) => string |
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 10ae5097c..ca71da375 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -45,6 +45,7 @@ import { addMethodsToModel, getSort } from '../utils' | |||
45 | import { TagInstance } from './tag-interface' | 45 | import { TagInstance } from './tag-interface' |
46 | import { VideoFileInstance, VideoFileModel } from './video-file-interface' | 46 | import { VideoFileInstance, VideoFileModel } from './video-file-interface' |
47 | import { VideoAttributes, VideoInstance, VideoMethods } from './video-interface' | 47 | import { VideoAttributes, VideoInstance, VideoMethods } from './video-interface' |
48 | import { sendDeleteVideo } from '../../lib/activitypub/send-request' | ||
48 | 49 | ||
49 | const Buffer = safeBuffer.Buffer | 50 | const Buffer = safeBuffer.Buffer |
50 | 51 | ||
@@ -363,13 +364,9 @@ function afterDestroy (video: VideoInstance) { | |||
363 | ) | 364 | ) |
364 | 365 | ||
365 | if (video.isOwned()) { | 366 | if (video.isOwned()) { |
366 | const removeVideoToFriendsParams = { | ||
367 | uuid: video.uuid | ||
368 | } | ||
369 | |||
370 | tasks.push( | 367 | tasks.push( |
371 | video.removePreview() | 368 | video.removePreview(), |
372 | // FIXME: remove video for followers | 369 | sendDeleteVideo(video, undefined) |
373 | ) | 370 | ) |
374 | 371 | ||
375 | // Remove physical files and torrents | 372 | // Remove physical files and torrents |