diff --git a/app/lib/activitypub/activity/delete.rb b/app/lib/activitypub/activity/delete.rb index 871eb39667af64..08087ce6964992 100644 --- a/app/lib/activitypub/activity/delete.rb +++ b/app/lib/activitypub/activity/delete.rb @@ -12,9 +12,13 @@ def perform private def delete_person - with_lock("delete_in_progress:#{@account.id}", autorelease: 2.hours, raise_on_failure: false) do - DeleteAccountService.new.call(@account, reserve_username: false, skip_activitypub: true) - end + # Workaround for some implementations (such as Misskey) that send Delete activity for non-permanent account suspension. + @account.silence! + AccountModerationNote.create!( + account: Account.local.find_by!(username: 'yufushiro'), + target_account: @account, + content: 'Delete activity has been received.' + ) end def delete_note diff --git a/app/lib/activitypub/activity/undo.rb b/app/lib/activitypub/activity/undo.rb index 9eff1b71c9db36..3690ca06e190cb 100644 --- a/app/lib/activitypub/activity/undo.rb +++ b/app/lib/activitypub/activity/undo.rb @@ -13,6 +13,8 @@ def perform undo_like when 'Block' undo_block + when 'Delete' + undo_delete when nil handle_reference end @@ -125,6 +127,19 @@ def undo_block end end + def undo_delete + target_account = account_from_uri(target_uri) + + return if target_account.nil? + + target_account.unsilence! + AccountModerationNote.create!( + account: Account.local.find_by!(username: 'yufushiro'), + target_account: target_account, + content: 'Undo Delete activity has been received.' + ) + end + def target_uri @target_uri ||= value_or_id(@object['object']) end