FULL = 'FULL'
}
+export const unusedActorAttributesForAPI = [
+ 'publicKey',
+ 'privateKey',
+ 'inboxUrl',
+ 'outboxUrl',
+ 'sharedInboxUrl',
+ 'followersUrl',
+ 'followingUrl',
+ 'url',
+ 'createdAt',
+ 'updatedAt'
+]
+
@DefaultScope({
include: [
{
return ActorModel.scope(ScopeNames.FULL).findAll(query)
}
- static loadLocalByName (preferredUsername: string) {
+ static loadLocalByName (preferredUsername: string, transaction?: Sequelize.Transaction) {
const query = {
where: {
preferredUsername,
serverId: null
- }
+ },
+ transaction
}
return ActorModel.scope(ScopeNames.FULL).findOne(query)
})
}
- static async getActorsFollowerSharedInboxUrls (actors: ActorModel[], t: Sequelize.Transaction) {
- const query = {
- // attribute: [],
- where: {
- id: {
- [Sequelize.Op.in]: actors.map(a => a.id)
- }
- },
- include: [
- {
- // attributes: [ ],
- model: ActorFollowModel.unscoped(),
- required: true,
- as: 'ActorFollowers',
- where: {
- state: 'accepted'
- },
- include: [
- {
- attributes: [ 'sharedInboxUrl' ],
- model: ActorModel.unscoped(),
- as: 'ActorFollower',
- required: true
- }
- ]
- }
- ],
- transaction: t
- }
-
- const hash: { [ id: number ]: string[] } = {}
- const res = await ActorModel.findAll(query)
- for (const actor of res) {
- hash[actor.id] = actor.ActorFollowers.map(follow => follow.ActorFollower.sharedInboxUrl)
- }
-
- return hash
- }
-
toFormattedJSON () {
let avatar: Avatar = null
if (this.Avatar) {