Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mastodon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pierre Boudes
mastodon
Commits
0397c58b
Commit
0397c58b
authored
7 years ago
by
Eugen Rochko
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Forward ActivityPub deletes to followers of rebloggers (#4706)
parent
884b085f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/lib/activitypub/activity/delete.rb
+18
-1
18 additions, 1 deletion
app/lib/activitypub/activity/delete.rb
app/workers/activitypub/raw_distribution_worker.rb
+23
-0
23 additions, 0 deletions
app/workers/activitypub/raw_distribution_worker.rb
with
41 additions
and
1 deletion
app/lib/activitypub/activity/delete.rb
+
18
−
1
View file @
0397c58b
...
...
@@ -8,7 +8,24 @@ class ActivityPub::Activity::Delete < ActivityPub::Activity
if
status
.
nil?
delete_later!
(
object_uri
)
else
RemoveStatusService
.
new
.
call
(
status
)
forward_for_reblogs
(
status
)
delete_now!
(
status
)
end
end
private
def
forward_for_reblogs
(
status
)
ActivityPub
::
RawDistributionWorker
.
push_bulk
(
status
.
reblogs
.
includes
(
:account
).
references
(
:account
).
merge
(
Account
.
local
).
pluck
(
:account_id
))
do
|
account
|
[
payload
,
account
.
id
]
end
end
def
delete_now!
(
status
)
RemoveStatusService
.
new
.
call
(
status
)
end
def
payload
@payload
||=
Oj
.
dump
(
@json
)
end
end
This diff is collapsed.
Click to expand it.
app/workers/activitypub/raw_distribution_worker.rb
0 → 100644
+
23
−
0
View file @
0397c58b
# frozen_string_literal: true
class
ActivityPub::RawDistributionWorker
include
Sidekiq
::
Worker
sidekiq_options
queue:
'push'
def
perform
(
json
,
source_account_id
)
@account
=
Account
.
find
(
source_account_id
)
ActivityPub
::
DeliveryWorker
.
push_bulk
(
inboxes
)
do
|
inbox_url
|
[
json
,
@account
.
id
,
inbox_url
]
end
rescue
ActiveRecord
::
RecordNotFound
true
end
private
def
inboxes
@inboxes
||=
@account
.
followers
.
inboxes
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment