diff options
Diffstat (limited to 'server/models/video/video-channel.ts')
-rw-r--r-- | server/models/video/video-channel.ts | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts index 5598d80f6..91dd0440c 100644 --- a/server/models/video/video-channel.ts +++ b/server/models/video/video-channel.ts | |||
@@ -28,7 +28,7 @@ import { AccountModel } from '../account/account' | |||
28 | import { ActorModel, unusedActorAttributesForAPI } from '../activitypub/actor' | 28 | import { ActorModel, unusedActorAttributesForAPI } from '../activitypub/actor' |
29 | import { buildTrigramSearchIndex, createSimilarityAttribute, getSort, throwIfNotValid } from '../utils' | 29 | import { buildTrigramSearchIndex, createSimilarityAttribute, getSort, throwIfNotValid } from '../utils' |
30 | import { VideoModel } from './video' | 30 | import { VideoModel } from './video' |
31 | import { CONSTRAINTS_FIELDS } from '../../initializers' | 31 | import { CONFIG, CONSTRAINTS_FIELDS } from '../../initializers' |
32 | import { ServerModel } from '../server/server' | 32 | import { ServerModel } from '../server/server' |
33 | import { DefineIndexesOptions } from 'sequelize' | 33 | import { DefineIndexesOptions } from 'sequelize' |
34 | 34 | ||
@@ -378,6 +378,14 @@ export class VideoChannelModel extends Model<VideoChannelModel> { | |||
378 | .findOne(query) | 378 | .findOne(query) |
379 | } | 379 | } |
380 | 380 | ||
381 | static loadByNameWithHostAndPopulateAccount (nameWithHost: string) { | ||
382 | const [ name, host ] = nameWithHost.split('@') | ||
383 | |||
384 | if (!host || host === CONFIG.WEBSERVER.HOST) return VideoChannelModel.loadLocalByNameAndPopulateAccount(name) | ||
385 | |||
386 | return VideoChannelModel.loadByNameAndHostAndPopulateAccount(name, host) | ||
387 | } | ||
388 | |||
381 | static loadLocalByNameAndPopulateAccount (name: string) { | 389 | static loadLocalByNameAndPopulateAccount (name: string) { |
382 | const query = { | 390 | const query = { |
383 | include: [ | 391 | include: [ |