diff options
| author | MeiMei <30769358+mei23@users.noreply.github.com> | 2020-11-01 12:14:42 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-01 12:14:42 +0900 |
| commit | cd0b0012d9da9109b0ea4adf0feb84b6c3b43f86 (patch) | |
| tree | 36cd61bc924e3711c05a4608b7829059b7a0d88a /src/remote/activitypub/db-resolver.ts | |
| parent | fix(client): ストリーミングのメモリリークを修正 (diff) | |
| download | sharkey-cd0b0012d9da9109b0ea4adf0feb84b6c3b43f86.tar.gz sharkey-cd0b0012d9da9109b0ea4adf0feb84b6c3b43f86.tar.bz2 sharkey-cd0b0012d9da9109b0ea4adf0feb84b6c3b43f86.zip | |
メッセージ (トーク/チャット) 削除の連合 (#6789)
Diffstat (limited to 'src/remote/activitypub/db-resolver.ts')
| -rw-r--r-- | src/remote/activitypub/db-resolver.ts | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/remote/activitypub/db-resolver.ts b/src/remote/activitypub/db-resolver.ts index 6f1cb1e110..cad2212b70 100644 --- a/src/remote/activitypub/db-resolver.ts +++ b/src/remote/activitypub/db-resolver.ts @@ -2,7 +2,8 @@ import config from '../../config'; import { Note } from '../../models/entities/note'; import { User, IRemoteUser } from '../../models/entities/user'; import { UserPublickey } from '../../models/entities/user-publickey'; -import { Notes, Users, UserPublickeys } from '../../models'; +import { MessagingMessage } from '../../models/entities/messaging-message'; +import { Notes, Users, UserPublickeys, MessagingMessages } from '../../models'; import { IObject, getApId } from './type'; import { resolvePerson } from './models/person'; import { ensure } from '../../prelude/ensure'; @@ -33,6 +34,24 @@ export default class DbResolver { return null; } + public async getMessageFromApId(value: string | IObject): Promise<MessagingMessage | null> { + const parsed = this.parseUri(value); + + if (parsed.id) { + return (await MessagingMessages.findOne({ + id: parsed.id + })) || null; + } + + if (parsed.uri) { + return (await MessagingMessages.findOne({ + uri: parsed.uri + })) || null; + } + + return null; + } + /** * AP Person => Misskey User in DB */ |