Skip to content

Commit

Permalink
Fix to not use bearcap when backing up status
Browse files Browse the repository at this point in the history
  • Loading branch information
noellabo committed Aug 19, 2021
1 parent 944e9a5 commit d9560f6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/presenters/activitypub/activity_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class ActivityPub::ActivityPresenter < ActiveModelSerializers::Model
attributes :id, :type, :actor, :published, :to, :cc, :virtual_object

class << self
def from_status(status)
def from_status(status, use_bearcap: true)
new.tap do |presenter|
presenter.id = ActivityPub::TagManager.instance.activity_uri_for(status)
presenter.type = status.reblog? ? 'Announce' : 'Create'
Expand All @@ -20,7 +20,7 @@ def from_status(status)
else
ActivityPub::TagManager.instance.uri_for(status.proper)
end
elsif status.limited_visibility?
elsif status.limited_visibility? && use_bearcap
"bear:?#{{ u: ActivityPub::TagManager.instance.uri_for(status.proper), t: status.capability_tokens.first.token }.to_query}"
else
status.proper
Expand Down
2 changes: 1 addition & 1 deletion app/services/backup_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def build_json!

account.statuses.with_includes.reorder(nil).find_in_batches do |statuses|
statuses.each do |status|
item = serialize_payload(ActivityPub::ActivityPresenter.from_status(status), ActivityPub::ActivitySerializer, signer: @account)
item = serialize_payload(ActivityPub::ActivityPresenter.from_status(status, use_bearcap: false), ActivityPub::ActivitySerializer, signer: @account)
item.delete(:'@context')

unless item[:type] == 'Announce' || item[:object][:attachment].blank?
Expand Down

0 comments on commit d9560f6

Please sign in to comment.