From 8d709351bdf1d9d57d1e4829223c62b6b42ae075 Mon Sep 17 00:00:00 2001 From: MeiMei <30769358+mei23@users.noreply.github.com> Date: Wed, 19 May 2021 16:15:01 +0900 Subject: [PATCH] Fix Announce/Delete AP deliver (#7517) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix Announce/Delete AP deliver * Revert "Fix Announce/Delete AP deliver" This reverts commit 0292c5196df48f67bb7914e925560ba69e2b2980. * localOnlyのDeleteをdeliverしないように * null Activityに対するUndoはdeliverしないように --- src/remote/activitypub/renderer/undo.ts | 14 +++++++++----- src/services/note/delete.ts | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/remote/activitypub/renderer/undo.ts b/src/remote/activitypub/renderer/undo.ts index 6f367415c..627a6533a 100644 --- a/src/remote/activitypub/renderer/undo.ts +++ b/src/remote/activitypub/renderer/undo.ts @@ -1,8 +1,12 @@ import config from '@/config'; import { ILocalUser, User } from '../../../models/entities/user'; -export default (object: any, user: { id: User['id'] }) => ({ - type: 'Undo', - actor: `${config.url}/users/${user.id}`, - object -}); +export default (object: any, user: { id: User['id'] }) => { + if (object == null) return null; + + return { + type: 'Undo', + actor: `${config.url}/users/${user.id}`, + object + }; +}; diff --git a/src/services/note/delete.ts b/src/services/note/delete.ts index 3f4f8b404..a7ac86e10 100644 --- a/src/services/note/delete.ts +++ b/src/services/note/delete.ts @@ -35,7 +35,7 @@ export default async function(user: User, note: Note, quiet = false) { }); //#region ローカルの投稿なら削除アクティビティを配送 - if (Users.isLocalUser(user)) { + if (Users.isLocalUser(user) && !note.localOnly) { let renote: Note | undefined; // if deletd note is renote