aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
Diffstat (limited to 'server/models')
-rw-r--r--server/models/account/account.ts37
1 files changed, 35 insertions, 2 deletions
diff --git a/server/models/account/account.ts b/server/models/account/account.ts
index bc7595a0e..c5955ef3b 100644
--- a/server/models/account/account.ts
+++ b/server/models/account/account.ts
@@ -157,7 +157,6 @@ export class AccountModel extends Model<AccountModel> {
157 static loadLocalByName (name: string) { 157 static loadLocalByName (name: string) {
158 const query = { 158 const query = {
159 where: { 159 where: {
160 name,
161 [ Sequelize.Op.or ]: [ 160 [ Sequelize.Op.or ]: [
162 { 161 {
163 userId: { 162 userId: {
@@ -170,7 +169,41 @@ export class AccountModel extends Model<AccountModel> {
170 } 169 }
171 } 170 }
172 ] 171 ]
173 } 172 },
173 include: [
174 {
175 model: ActorModel,
176 required: true,
177 where: {
178 preferredUsername: name
179 }
180 }
181 ]
182 }
183
184 return AccountModel.findOne(query)
185 }
186
187 static loadLocalByNameAndHost (name: string, host: string) {
188 const query = {
189 include: [
190 {
191 model: ActorModel,
192 required: true,
193 where: {
194 preferredUsername: name
195 },
196 include: [
197 {
198 model: ServerModel,
199 required: true,
200 where: {
201 host
202 }
203 }
204 ]
205 }
206 ]
174 } 207 }
175 208
176 return AccountModel.findOne(query) 209 return AccountModel.findOne(query)