From 54141398354e6e7b94aa3065a705a1251390111c Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 20 Nov 2017 09:43:39 +0100 Subject: Refractor activity pub lib/helpers --- server/models/video/video-channel.ts | 16 +++++----------- server/models/video/video.ts | 7 +++---- 2 files changed, 8 insertions(+), 15 deletions(-) (limited to 'server/models/video') diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts index f8414d4a8..93566a5c6 100644 --- a/server/models/video/video-channel.ts +++ b/server/models/video/video-channel.ts @@ -1,17 +1,11 @@ import * as Sequelize from 'sequelize' - -import { isVideoChannelNameValid, isVideoChannelDescriptionValid } from '../../helpers' - -import { addMethodsToModel, getSort } from '../utils' -import { - VideoChannelInstance, - VideoChannelAttributes, - - VideoChannelMethods -} from './video-channel-interface' -import { sendDeleteVideoChannel } from '../../lib/activitypub/send-request' +import { isVideoChannelDescriptionValid, isVideoChannelNameValid } from '../../helpers' import { isVideoChannelUrlValid } from '../../helpers/custom-validators/video-channels' import { CONSTRAINTS_FIELDS } from '../../initializers/constants' +import { sendDeleteVideoChannel } from '../../lib/activitypub/send/send-delete' + +import { addMethodsToModel, getSort } from '../utils' +import { VideoChannelAttributes, VideoChannelInstance, VideoChannelMethods } from './video-channel-interface' let VideoChannel: Sequelize.Model let toFormattedJSON: VideoChannelMethods.ToFormattedJSON diff --git a/server/models/video/video.ts b/server/models/video/video.ts index dc10aca1a..e2069eb0c 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts @@ -9,7 +9,6 @@ import { VideoTorrentObject } from '../../../shared/models/activitypub/objects/v import { createTorrentPromise, generateImageFromVideoFile, - getActivityPubUrl, getVideoFileHeight, isVideoCategoryValid, isVideoDescriptionValid, @@ -40,13 +39,13 @@ import { VIDEO_LICENCES, VIDEO_PRIVACIES } from '../../initializers' -import { sendDeleteVideo } from '../../lib/activitypub/send-request' import { addMethodsToModel, getSort } from '../utils' import { TagInstance } from './tag-interface' import { VideoFileInstance, VideoFileModel } from './video-file-interface' import { VideoAttributes, VideoInstance, VideoMethods } from './video-interface' +import { sendDeleteVideo } from '../../lib/index' const Buffer = safeBuffer.Buffer @@ -584,7 +583,7 @@ toActivityPubObject = function (this: VideoInstance) { const videoObject: VideoTorrentObject = { type: 'Video' as 'Video', - id: getActivityPubUrl('video', this.uuid), + id: this.url, name: this.name, // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-duration duration: 'PT' + this.duration + 'S', @@ -615,7 +614,7 @@ toActivityPubObject = function (this: VideoInstance) { width: THUMBNAILS_SIZE.width, height: THUMBNAILS_SIZE.height }, - url + url // FIXME: needed? } return videoObject -- cgit v1.2.3