import { VideoChannelModel } from '../video/video-channel'
import { VideoCommentModel } from '../video/video-comment'
import { UserModel } from './user'
+import * as Bluebird from '../../helpers/custom-validators/accounts'
+import { CONFIG } from '../../initializers'
@DefaultScope({
include: [
return AccountModel.findOne(query)
}
+ static loadByNameWithHost (nameWithHost: string) {
+ const [ accountName, host ] = nameWithHost.split('@')
+
+ if (!host || host === CONFIG.WEBSERVER.HOST) return AccountModel.loadLocalByName(accountName)
+
+ return AccountModel.loadByNameAndHost(accountName, host)
+ }
+
static loadLocalByName (name: string) {
const query = {
where: {