},
{
model: () => VideoChannelModel.unscoped(),
- required: false
+ required: false,
+ include: [
+ {
+ model: () => AccountModel,
+ required: true
+ }
+ ]
},
{
model: () => ServerModel,
return ActorModel.unscoped().findById(id)
}
+ static isActorUrlExist (url: string) {
+ const query = {
+ raw: true,
+ where: {
+ url
+ }
+ }
+
+ return ActorModel.unscoped().findOne(query)
+ .then(a => !!a)
+ }
+
static listByFollowersUrls (followersUrls: string[], transaction?: Sequelize.Transaction) {
const query = {
where: {
}
static loadByUrl (url: string, transaction?: Sequelize.Transaction) {
+ const query = {
+ where: {
+ url
+ },
+ transaction,
+ include: [
+ {
+ attributes: [ 'id' ],
+ model: AccountModel.unscoped(),
+ required: false
+ },
+ {
+ attributes: [ 'id' ],
+ model: VideoChannelModel.unscoped(),
+ required: false
+ }
+ ]
+ }
+
+ return ActorModel.unscoped().findOne(query)
+ }
+
+ static loadByUrlAndPopulateAccountAndChannel (url: string, transaction?: Sequelize.Transaction) {
const query = {
where: {
url
uuid: this.uuid,
name: this.preferredUsername,
host: this.getHost(),
+ hostRedundancyAllowed: this.getRedundancyAllowed(),
followingCount: this.followingCount,
followersCount: this.followersCount,
avatar,
return this.Server ? this.Server.host : CONFIG.WEBSERVER.HOST
}
+ getRedundancyAllowed () {
+ return this.Server ? this.Server.redundancyAllowed : false
+ }
+
getAvatarUrl () {
if (!this.avatarId) return undefined