diff options
author | Claire <claire.github-309c@sitedethib.com> | 2023-11-07 11:44:59 +0100 |
---|---|---|
committer | Claire <claire.github-309c@sitedethib.com> | 2023-11-07 11:44:59 +0100 |
commit | 77e587129a2f1b5b891034c03eaf9a2f6c7df406 (patch) | |
tree | 5b5b2358263537e6c4ce8a3b0e710b4db6086ab6 | |
parent | 3bf2a7296e6d80d5cd9d5d3cba1507af6ba83dfd (diff) |
Fix verified links being re-checked on all profile fetchesfixes/account-refresh-link-verification
Fixes #27755
-rw-r--r-- | app/models/account.rb | 12 | ||||
-rw-r--r-- | app/services/activitypub/process_account_service.rb | 2 |
2 files changed, 13 insertions, 1 deletions
diff --git a/app/models/account.rb b/app/models/account.rb index a25ebc4aaf1..4b7597dad98 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -324,6 +324,18 @@ class Account < ApplicationRecord end end + def fields=(fields) + old_fields = self[:fields] || [] + old_fields = [] if old_fields.is_a?(Hash) + + self[:fields] = fields.map do |field| + verified_at = old_fields.find { |item| item['value'] == field['value'] }&.fetch('verified_at', nil) + next field if verified_at.blank? + + field.merge('verified_at' => verified_at) + end + end + def fields_attributes=(attributes) fields = [] old_fields = self[:fields] || [] diff --git a/app/services/activitypub/process_account_service.rb b/app/services/activitypub/process_account_service.rb index 1304ca8242b..32df8448d84 100644 --- a/app/services/activitypub/process_account_service.rb +++ b/app/services/activitypub/process_account_service.rb @@ -232,7 +232,7 @@ class ActivityPub::ProcessAccountService < BaseService def property_values return unless @json['attachment'].is_a?(Array) - as_array(@json['attachment']).select { |attachment| attachment['type'] == 'PropertyValue' }.map { |attachment| attachment.slice('name', 'value') } + as_array(@json['attachment']).filter_map { |attachment| attachment.slice('name', 'value') if attachment['type'] == 'PropertyValue' } end def mismatching_origin?(url) |