diff options
author | Claire <claire.github-309c@sitedethib.com> | 2022-02-10 19:09:27 +0100 |
---|---|---|
committer | Claire <claire.github-309c@sitedethib.com> | 2022-02-10 19:09:27 +0100 |
commit | f1a6f9062e00c0651680bf4d5d750ec0b078ac5a (patch) | |
tree | 30d40f0b5df56e955f80a91ae3b44090bd918ed9 /app/workers | |
parent | d602c92b310545eb733a58caed49717341abe27c (diff) | |
parent | 3dc1e3cfc3928ce709c3e60e98ecbd1edd6e2a7d (diff) |
Merge branch 'main' into glitch-soc/merge-upstream
Conflicts: - `app/controllers/api/v1/statuses_controller.rb`: Upstream moved things around in a place where glitch-soc had support for an extra parameter (`content_type`). Follow upstream but reintroduce `content_type`.
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/activitypub/status_update_distribution_worker.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/app/workers/activitypub/status_update_distribution_worker.rb b/app/workers/activitypub/status_update_distribution_worker.rb new file mode 100644 index 000000000..a79ede2bf --- /dev/null +++ b/app/workers/activitypub/status_update_distribution_worker.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +class ActivityPub::StatusUpdateDistributionWorker < ActivityPub::DistributionWorker + # Distribute an profile update to servers that might have a copy + # of the account in question + def perform(status_id, options = {}) + @options = options.with_indifferent_access + @status = Status.find(status_id) + @account = @status.account + + distribute! + rescue ActiveRecord::RecordNotFound + true + end + + protected + + def activity + ActivityPub::ActivityPresenter.new( + id: [ActivityPub::TagManager.instance.uri_for(@status), '#updates/', @status.edited_at.to_i].join, + type: 'Update', + actor: ActivityPub::TagManager.instance.uri_for(@status.account), + published: @status.edited_at, + to: ActivityPub::TagManager.instance.to(@status), + cc: ActivityPub::TagManager.instance.cc(@status), + virtual_object: @status + ) + end +end |