diff options
author | Claire <claire.github-309c@sitedethib.com> | 2022-02-10 21:07:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-10 21:07:48 +0100 |
commit | 776e337b8d2aa66440bc4565617b5440ca781e1a (patch) | |
tree | d9d30c63622c58a343cea58a3509337630491609 /app/workers | |
parent | d602c92b310545eb733a58caed49717341abe27c (diff) | |
parent | 642b5a621acdcae091f8bdb0f367018309616f71 (diff) |
Merge pull request #1683 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
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 |