From b16c3798a471b25063337cdfe9e74830fbd4daa3 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 6f367415c4..627a6533ab 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 3f4f8b404c..a7ac86e106 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