1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-06 03:50:26 +02:00

Add federation to ownership change

This commit is contained in:
Chocobozzz 2018-09-04 10:22:10 +02:00
parent 0b74c74abe
commit 5cf84858d4
No known key found for this signature in database
GPG key ID: 583A612D890159BE
13 changed files with 139 additions and 79 deletions

View file

@ -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<UserModel> {
}
}
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<UserModel> {
return parseInt(total, 10)
})
}
static autocomplete (search: string) {
return UserModel.findAll({
where: {
username: {
[Sequelize.Op.like]: `%${search}%`
}
}
})
.then(u => u.map(u => u.username))
}
}