static loadLocalByName (name: string) {
const query = {
where: {
- name,
[ Sequelize.Op.or ]: [
{
userId: {
}
}
]
- }
+ },
+ include: [
+ {
+ model: ActorModel,
+ required: true,
+ where: {
+ preferredUsername: name
+ }
+ }
+ ]
+ }
+
+ return AccountModel.findOne(query)
+ }
+
+ static loadLocalByNameAndHost (name: string, host: string) {
+ const query = {
+ include: [
+ {
+ model: ActorModel,
+ required: true,
+ where: {
+ preferredUsername: name
+ },
+ include: [
+ {
+ model: ServerModel,
+ required: true,
+ where: {
+ host
+ }
+ }
+ ]
+ }
+ ]
}
return AccountModel.findOne(query)
const query = {
offset: start,
limit: count,
- order: getSort(sort),
+ order: getSort(sort)
}
return AccountModel.findAndCountAll(query)
const actor = this.Actor.toFormattedJSON()
const account = {
id: this.id,
- displayName: this.name,
+ displayName: this.getDisplayName(),
description: this.description,
createdAt: this.createdAt,
updatedAt: this.updatedAt
isOwned () {
return this.Actor.isOwned()
}
+
+ getDisplayName () {
+ return this.name
+ }
}