Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Mastodon
Commits
eb997c9f
Commit
eb997c9f
authored
3 months ago
by
Claire
Browse files
Options
Downloads
Patches
Plain Diff
Fix processing incoming post edits with mentions to unresolvable accounts (#33129)
parent
4239baa1
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/services/activitypub/process_status_update_service.rb
+12
-0
12 additions, 0 deletions
app/services/activitypub/process_status_update_service.rb
with
12 additions
and
0 deletions
app/services/activitypub/process_status_update_service.rb
+
12
−
0
View file @
eb997c9f
...
...
@@ -190,6 +190,7 @@ class ActivityPub::ProcessStatusUpdateService < BaseService
def
update_mentions!
previous_mentions
=
@status
.
active_mentions
.
includes
(
:account
).
to_a
current_mentions
=
[]
unresolved_mentions
=
[]
@raw_mentions
.
each
do
|
href
|
next
if
href
.
blank?
...
...
@@ -203,6 +204,12 @@ class ActivityPub::ProcessStatusUpdateService < BaseService
mention
||=
account
.
mentions
.
new
(
status:
@status
)
current_mentions
<<
mention
rescue
Mastodon
::
UnexpectedResponseError
,
*
Mastodon
::
HTTP_CONNECTION_ERRORS
# Since previous mentions are about already-known accounts,
# they don't try to resolve again and won't fall into this case.
# In other words, this failure case is only for new mentions and won't
# affect `removed_mentions` so they can safely be retried asynchronously
unresolved_mentions
<<
href
end
current_mentions
.
each
do
|
mention
|
...
...
@@ -215,6 +222,11 @@ class ActivityPub::ProcessStatusUpdateService < BaseService
removed_mentions
=
previous_mentions
-
current_mentions
Mention
.
where
(
id:
removed_mentions
.
map
(
&
:id
)).
update_all
(
silent:
true
)
unless
removed_mentions
.
empty?
# Queue unresolved mentions for later
unresolved_mentions
.
uniq
.
each
do
|
uri
|
MentionResolveWorker
.
perform_in
(
rand
(
30
...
600
).
seconds
,
@status
.
id
,
uri
,
{
'request_id'
=>
@request_id
})
end
end
def
update_emojis!
...
...
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