From 5cf84858d49f4231cc4efec5e3132f17f65f6cf6 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 4 Sep 2018 10:22:10 +0200 Subject: Add federation to ownership change --- server/models/account/user.ts | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'server/models/account') diff --git a/server/models/account/user.ts b/server/models/account/user.ts index 4b13e47a0..680b1d52d 100644 --- a/server/models/account/user.ts +++ b/server/models/account/user.ts @@ -23,13 +23,13 @@ import { isUserAutoPlayVideoValid, isUserBlockedReasonValid, isUserBlockedValid, - isUserNSFWPolicyValid, isUserEmailVerifiedValid, + isUserNSFWPolicyValid, isUserPasswordValid, isUserRoleValid, isUserUsernameValid, - isUserVideoQuotaValid, - isUserVideoQuotaDailyValid + isUserVideoQuotaDailyValid, + isUserVideoQuotaValid } from '../../helpers/custom-validators/users' import { comparePassword, cryptPassword } from '../../helpers/peertube-crypto' import { OAuthTokenModel } from '../oauth/oauth-token' @@ -39,7 +39,6 @@ import { AccountModel } from './account' import { NSFWPolicyType } from '../../../shared/models/videos/nsfw-policy.type' import { values } from 'lodash' import { NSFW_POLICY_TYPES } from '../../initializers' -import { VideoFileModel } from '../video/video-file' enum ScopeNames { WITH_VIDEO_CHANNEL = 'WITH_VIDEO_CHANNEL' @@ -296,6 +295,20 @@ export class UserModel extends Model { } } + static autoComplete (search: string) { + const query = { + where: { + username: { + [ Sequelize.Op.like ]: `%${search}%` + } + }, + limit: 10 + } + + return UserModel.findAll(query) + .then(u => u.map(u => u.username)) + } + hasRight (right: UserRight) { return hasUserRight(this.role, right) } @@ -394,15 +407,4 @@ export class UserModel extends Model { return parseInt(total, 10) }) } - - static autocomplete (search: string) { - return UserModel.findAll({ - where: { - username: { - [Sequelize.Op.like]: `%${search}%` - } - } - }) - .then(u => u.map(u => u.username)) - } } -- cgit v1.2.3