diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2022-03-26 15:34:00 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-26 15:34:00 +0900 |
| commit | 1c67c26bd87aae64fe0f2ef45140e12a78564699 (patch) | |
| tree | 633a3fad1c5841ea20bc39d6b681b455bbdeabf3 /packages/backend/src/server/activitypub.ts | |
| parent | .js (diff) | |
| download | misskey-1c67c26bd87aae64fe0f2ef45140e12a78564699.tar.gz misskey-1c67c26bd87aae64fe0f2ef45140e12a78564699.tar.bz2 misskey-1c67c26bd87aae64fe0f2ef45140e12a78564699.zip | |
refactor: migrate to typeorm 3.0 (#8443)
* wip
* wip
* wip
* Update following.ts
* wip
* wip
* wip
* Update resolve-user.ts
* maxQueryExecutionTime
* wip
* wip
Diffstat (limited to 'packages/backend/src/server/activitypub.ts')
| -rw-r--r-- | packages/backend/src/server/activitypub.ts | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/packages/backend/src/server/activitypub.ts b/packages/backend/src/server/activitypub.ts index d4871ca9d7..c35b65674b 100644 --- a/packages/backend/src/server/activitypub.ts +++ b/packages/backend/src/server/activitypub.ts @@ -15,7 +15,7 @@ import { inbox as processInbox } from '@/queue/index.js'; import { isSelfHost } from '@/misc/convert-host.js'; import { Notes, Users, Emojis, NoteReactions } from '@/models/index.js'; import { ILocalUser, User } from '@/models/entities/user.js'; -import { In } from 'typeorm'; +import { In, IsNull } from 'typeorm'; import { renderLike } from '@/remote/activitypub/renderer/like.js'; import { getUserKeypair } from '@/misc/keypair-store.js'; @@ -65,7 +65,7 @@ router.post('/users/:user/inbox', json(), inbox); router.get('/notes/:note', async (ctx, next) => { if (!isActivityPubReq(ctx)) return await next(); - const note = await Notes.findOne({ + const note = await Notes.findOneBy({ id: ctx.params.note, visibility: In(['public' as const, 'home' as const]), localOnly: false, @@ -93,9 +93,9 @@ router.get('/notes/:note', async (ctx, next) => { // note activity router.get('/notes/:note/activity', async ctx => { - const note = await Notes.findOne({ + const note = await Notes.findOneBy({ id: ctx.params.note, - userHost: null, + userHost: IsNull(), visibility: In(['public' as const, 'home' as const]), localOnly: false, }); @@ -126,9 +126,9 @@ router.get('/users/:user/collections/featured', Featured); router.get('/users/:user/publickey', async ctx => { const userId = ctx.params.user; - const user = await Users.findOne({ + const user = await Users.findOneBy({ id: userId, - host: null, + host: IsNull(), }); if (user == null) { @@ -164,9 +164,9 @@ router.get('/users/:user', async (ctx, next) => { const userId = ctx.params.user; - const user = await Users.findOne({ + const user = await Users.findOneBy({ id: userId, - host: null, + host: IsNull(), isSuspended: false, }); @@ -176,9 +176,9 @@ router.get('/users/:user', async (ctx, next) => { router.get('/@:user', async (ctx, next) => { if (!isActivityPubReq(ctx)) return await next(); - const user = await Users.findOne({ + const user = await Users.findOneBy({ usernameLower: ctx.params.user.toLowerCase(), - host: null, + host: IsNull(), isSuspended: false, }); @@ -188,8 +188,8 @@ router.get('/@:user', async (ctx, next) => { // emoji router.get('/emojis/:emoji', async ctx => { - const emoji = await Emojis.findOne({ - host: null, + const emoji = await Emojis.findOneBy({ + host: IsNull(), name: ctx.params.emoji, }); @@ -205,14 +205,14 @@ router.get('/emojis/:emoji', async ctx => { // like router.get('/likes/:like', async ctx => { - const reaction = await NoteReactions.findOne(ctx.params.like); + const reaction = await NoteReactions.findOneBy({ id: ctx.params.like }); if (reaction == null) { ctx.status = 404; return; } - const note = await Notes.findOne(reaction.noteId); + const note = await Notes.findOneBy({ id: reaction.noteId }); if (note == null) { ctx.status = 404; |