aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/account
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/account')
-rw-r--r--server/models/account/user.ts15
1 files changed, 3 insertions, 12 deletions
diff --git a/server/models/account/user.ts b/server/models/account/user.ts
index 8eb88062a..809e821bd 100644
--- a/server/models/account/user.ts
+++ b/server/models/account/user.ts
@@ -121,17 +121,6 @@ export class UserModel extends Model<UserModel> {
121 return this.count() 121 return this.count()
122 } 122 }
123 123
124 static getByUsername (username: string) {
125 const query = {
126 where: {
127 username: username
128 },
129 include: [ { model: AccountModel, required: true } ]
130 }
131
132 return UserModel.findOne(query)
133 }
134
135 static listForApi (start: number, count: number, sort: string) { 124 static listForApi (start: number, count: number, sort: string) {
136 const query = { 125 const query = {
137 offset: start, 126 offset: start,
@@ -172,7 +161,9 @@ export class UserModel extends Model<UserModel> {
172 return UserModel.scope('withVideoChannel').findOne(query) 161 return UserModel.scope('withVideoChannel').findOne(query)
173 } 162 }
174 163
175 static loadByUsernameOrEmail (username: string, email: string) { 164 static loadByUsernameOrEmail (username: string, email?: string) {
165 if (!email) email = username
166
176 const query = { 167 const query = {
177 where: { 168 where: {
178 [ Sequelize.Op.or ]: [ { username }, { email } ] 169 [ Sequelize.Op.or ]: [ { username }, { email } ]