]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/helpers/custom-validators/video-channels.ts
Improve channel and account SEO
[github/Chocobozzz/PeerTube.git] / server / helpers / custom-validators / video-channels.ts
index f13519c1dd0de4fe1604d482e83da2fdadda541b..cbf150e53d29bd85ef37912cdcf918fb1c4e5731 100644 (file)
@@ -38,11 +38,7 @@ async function isVideoChannelIdExist (id: string, res: express.Response) {
 }
 
 async function isVideoChannelNameWithHostExist (nameWithDomain: string, res: express.Response) {
-  const [ name, host ] = nameWithDomain.split('@')
-  let videoChannel: VideoChannelModel
-
-  if (!host || host === CONFIG.WEBSERVER.HOST) videoChannel = await VideoChannelModel.loadLocalByNameAndPopulateAccount(name)
-  else videoChannel = await VideoChannelModel.loadByNameAndHostAndPopulateAccount(name, host)
+  const videoChannel = await VideoChannelModel.loadByNameWithHostAndPopulateAccount(nameWithDomain)
 
   return processVideoChannelExist(videoChannel, res)
 }