Add ng words for post/update

This commit is contained in:
KMY 2023-07-24 10:38:36 +09:00
parent d4602118fb
commit c553275381
12 changed files with 110 additions and 2 deletions

View file

@ -18,7 +18,7 @@ class ActivityPub::ProcessStatusUpdateService < BaseService
@request_id = request_id
# Only native types can be updated at the moment
return @status if !expected_type? || already_updated_more_recently?
return @status if !expected_type? || already_updated_more_recently? || !valid_status?
if @status_parser.edited_at.present? && (@status.edited_at.nil? || @status_parser.edited_at > @status.edited_at)
handle_explicit_update!
@ -152,6 +152,10 @@ class ActivityPub::ProcessStatusUpdateService < BaseService
end
end
def valid_status?
!Admin::NgWord.reject?("#{@status_parser.spoiler_text}\n#{@status_parser.text}")
end
def update_immediate_attributes!
@status.text = @status_parser.text || ''
@status.spoiler_text = @status_parser.spoiler_text || ''