mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-02-19 00:53:51 -05:00
Fix handling of duplicate mentions in incoming status Update
(#33911)
This commit is contained in:
parent
6b52227fcc
commit
1248c4d1f4
@ -227,7 +227,7 @@ class ActivityPub::ProcessStatusUpdateService < BaseService
|
|||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
@status.mentions.upsert_all(currently_mentioned_account_ids.map { |id| { account_id: id, silent: false } }, unique_by: %w(status_id account_id))
|
@status.mentions.upsert_all(currently_mentioned_account_ids.uniq.map { |id| { account_id: id, silent: false } }, unique_by: %w(status_id account_id))
|
||||||
|
|
||||||
# If previous mentions are no longer contained in the text, convert them
|
# If previous mentions are no longer contained in the text, convert them
|
||||||
# to silent mentions, since withdrawing access from someone who already
|
# to silent mentions, since withdrawing access from someone who already
|
||||||
|
@ -37,10 +37,16 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||||||
content: '@bob lorem ipsum',
|
content: '@bob lorem ipsum',
|
||||||
published: 1.hour.ago.utc.iso8601,
|
published: 1.hour.ago.utc.iso8601,
|
||||||
updated: 1.hour.ago.utc.iso8601,
|
updated: 1.hour.ago.utc.iso8601,
|
||||||
tag: {
|
tag: [
|
||||||
|
{
|
||||||
type: 'Mention',
|
type: 'Mention',
|
||||||
href: ActivityPub::TagManager.instance.uri_for(follower),
|
href: ActivityPub::TagManager.instance.uri_for(follower),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
type: 'Mention',
|
||||||
|
href: ActivityPub::TagManager.instance.uri_for(follower),
|
||||||
|
},
|
||||||
|
],
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService do
|
|||||||
tag: [
|
tag: [
|
||||||
{ type: 'Hashtag', name: 'hoge' },
|
{ type: 'Hashtag', name: 'hoge' },
|
||||||
{ type: 'Mention', href: ActivityPub::TagManager.instance.uri_for(alice) },
|
{ type: 'Mention', href: ActivityPub::TagManager.instance.uri_for(alice) },
|
||||||
|
{ type: 'Mention', href: ActivityPub::TagManager.instance.uri_for(alice) },
|
||||||
{ type: 'Mention', href: bogus_mention },
|
{ type: 'Mention', href: bogus_mention },
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user