Block account bio with ng_words

This commit is contained in:
KMY 2023-07-31 10:00:10 +09:00
parent 266823643e
commit bfdc7c41f2

View file

@ -21,6 +21,8 @@ class ActivityPub::ProcessAccountService < BaseService
@domain = TagManager.instance.normalize_domain(domain) @domain = TagManager.instance.normalize_domain(domain)
@collections = {} @collections = {}
return unless valid_account?
# The key does not need to be unguessable, it just needs to be somewhat unique # The key does not need to be unguessable, it just needs to be somewhat unique
@options[:request_id] ||= "#{Time.now.utc.to_i}-#{username}@#{domain}" @options[:request_id] ||= "#{Time.now.utc.to_i}-#{username}@#{domain}"
@ -123,6 +125,12 @@ class ActivityPub::ProcessAccountService < BaseService
@account.settings = other_settings @account.settings = other_settings
end end
def valid_account?
display_name = @json['name']
note = @json['summary']
!Admin::NgWord.reject?(display_name) && !Admin::NgWord.reject?(note)
end
def set_fetchable_key! def set_fetchable_key!
@account.public_key = public_key || '' @account.public_key = public_key || ''
end end