Skip to content

Commit

Permalink
[yufushiro] 恒久的でないアカウント凍結にDelete activityを使用する実装に対する回避策
Browse files Browse the repository at this point in the history
  • Loading branch information
yufushiro committed Dec 22, 2023
1 parent 8f55ca2 commit b8dd121
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
10 changes: 7 additions & 3 deletions app/lib/activitypub/activity/delete.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions app/lib/activitypub/activity/undo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ def perform
undo_like
when 'Block'
undo_block
when 'Delete'
undo_delete
when nil
handle_reference
end
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b8dd121

Please sign in to comment.