mirror of
https://github.com/yingziwu/mastodon.git
synced 2026-02-04 03:25:14 +00:00
Fix error when encountering invalid tag in updated object (#37635)
This commit is contained in:
parent
81716f7e27
commit
569ff6c8ad
2 changed files with 6 additions and 1 deletions
|
|
@ -204,7 +204,11 @@ class ActivityPub::ProcessStatusUpdateService < BaseService
|
||||||
|
|
||||||
def update_tags!
|
def update_tags!
|
||||||
previous_tags = @status.tags.to_a
|
previous_tags = @status.tags.to_a
|
||||||
current_tags = @status.tags = Tag.find_or_create_by_names(@raw_tags)
|
current_tags = @status.tags = @raw_tags.flat_map do |tag|
|
||||||
|
Tag.find_or_create_by_names([tag]).filter(&:valid?)
|
||||||
|
rescue ActiveRecord::RecordInvalid
|
||||||
|
[]
|
||||||
|
end
|
||||||
|
|
||||||
return unless @status.distributable?
|
return unless @status.distributable?
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -258,6 +258,7 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService do
|
||||||
tag: [
|
tag: [
|
||||||
{ type: 'Hashtag', name: 'foo' },
|
{ type: 'Hashtag', name: 'foo' },
|
||||||
{ type: 'Hashtag', name: 'bar' },
|
{ type: 'Hashtag', name: 'bar' },
|
||||||
|
{ type: 'Hashtag', name: '#2024' },
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue