From 54141398354e6e7b94aa3065a705a1251390111c Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 20 Nov 2017 09:43:39 +0100 Subject: Refractor activity pub lib/helpers --- server/models/account/account-follow.ts | 14 +++++++++++++- server/models/account/account-interface.ts | 2 +- server/models/account/account.ts | 3 +-- 3 files changed, 15 insertions(+), 4 deletions(-) (limited to 'server/models/account') diff --git a/server/models/account/account-follow.ts b/server/models/account/account-follow.ts index cc9b7c42b..f00c7dcd9 100644 --- a/server/models/account/account-follow.ts +++ b/server/models/account/account-follow.ts @@ -78,7 +78,19 @@ loadByAccountAndTarget = function (accountId: number, targetAccountId: number) { where: { accountId, targetAccountId - } + }, + include: [ + { + model: AccountFollow[ 'sequelize' ].models.Account, + required: true, + as: 'AccountFollower' + }, + { + model: AccountFollow['sequelize'].models.Account, + required: true, + as: 'AccountFollowing' + } + ] } return AccountFollow.findOne(query) diff --git a/server/models/account/account-interface.ts b/server/models/account/account-interface.ts index 1a567fb7a..e30260f76 100644 --- a/server/models/account/account-interface.ts +++ b/server/models/account/account-interface.ts @@ -37,7 +37,7 @@ export interface AccountClass { export interface AccountAttributes { name: string - url: string + url?: string publicKey: string privateKey: string followersCount: number diff --git a/server/models/account/account.ts b/server/models/account/account.ts index faf5fa841..9a2921501 100644 --- a/server/models/account/account.ts +++ b/server/models/account/account.ts @@ -1,5 +1,4 @@ import * as Sequelize from 'sequelize' - import { activityPubContextify, isAccountFollowersCountValid, @@ -15,7 +14,7 @@ import { isUserUsernameValid } from '../../helpers' import { CONFIG, CONSTRAINTS_FIELDS } from '../../initializers/constants' -import { sendDeleteAccount } from '../../lib/activitypub/send-request' +import { sendDeleteAccount } from '../../lib/activitypub/send/send-delete' import { addMethodsToModel } from '../utils' import { AccountAttributes, AccountInstance, AccountMethods } from './account-interface' -- cgit v1.2.3