diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2021-03-24 11:05:37 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-24 11:05:37 +0900 |
| commit | ce340aba7a37394c70b9f3d7cece9cfa5e91d94c (patch) | |
| tree | 99612ea0d039f20e0baa9ca243e8cec0af96b11a /src/services/following/create.ts | |
| parent | fix bug (diff) | |
| download | misskey-ce340aba7a37394c70b9f3d7cece9cfa5e91d94c.tar.gz misskey-ce340aba7a37394c70b9f3d7cece9cfa5e91d94c.tar.bz2 misskey-ce340aba7a37394c70b9f3d7cece9cfa5e91d94c.zip | |
Refactor (#7394)
* wip
* wip
* wip
* wip
* wip
* Update define.ts
* Update update.ts
* Update user.ts
* wip
* wip
* Update request.ts
* URL
* wip
* wip
* wip
* wip
* Update invite.ts
* Update create.ts
Diffstat (limited to 'src/services/following/create.ts')
| -rw-r--r-- | src/services/following/create.ts | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/services/following/create.ts b/src/services/following/create.ts index a759bef0f9..de12285fc7 100644 --- a/src/services/following/create.ts +++ b/src/services/following/create.ts @@ -17,7 +17,7 @@ import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error'; const logger = new Logger('following/create'); -export async function insertFollowingDoc(followee: User, follower: User) { +export async function insertFollowingDoc(followee: { id: User['id']; host: User['host']; uri: User['host']; inbox: User['inbox']; sharedInbox: User['sharedInbox'] }, follower: { id: User['id']; host: User['host']; uri: User['host']; inbox: User['inbox']; sharedInbox: User['sharedInbox'] }) { if (follower.id === followee.id) return; let alreadyFollowed = false; @@ -86,7 +86,7 @@ export async function insertFollowingDoc(followee: User, follower: User) { // Publish follow event if (Users.isLocalUser(follower)) { - Users.pack(followee, follower, { + Users.pack(followee.id, follower, { detail: true }).then(packed => { publishUserEvent(follower.id, 'follow', packed); @@ -96,7 +96,7 @@ export async function insertFollowingDoc(followee: User, follower: User) { // Publish followed event if (Users.isLocalUser(followee)) { - Users.pack(follower, followee).then(packed => publishMainStream(followee.id, 'followed', packed)); + Users.pack(follower.id, followee).then(packed => publishMainStream(followee.id, 'followed', packed)); // 通知を作成 createNotification(followee.id, 'follow', { @@ -105,7 +105,12 @@ export async function insertFollowingDoc(followee: User, follower: User) { } } -export default async function(follower: User, followee: User, requestId?: string) { +export default async function(_follower: { id: User['id'] }, _followee: { id: User['id'] }, requestId?: string) { + const [follower, followee] = await Promise.all([ + Users.findOneOrFail(_follower.id), + Users.findOneOrFail(_followee.id) + ]); + // check blocking const [blocking, blocked] = await Promise.all([ Blockings.findOne({ |