Add: #43 フォローしていないアカウントからのリプライのNGワード (#148)

* Add: フォローしていないアカウントからのリプライのNGワード

* Test: ハッシュタグ使用量
This commit is contained in:
KMY(雪あすか) 2023-10-19 12:12:00 +09:00 committed by GitHub
parent da662d2f84
commit 3a2030dfc8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 223 additions and 5 deletions

View file

@ -18,6 +18,10 @@ class Admin::NgWord
hashtag_reject?(Extractor.extract_hashtags(text)&.size || 0)
end
def stranger_mention_reject?(text)
ng_words_for_stranger_mention.any? { |word| include?(text, word) }
end
private
def include?(text, word)
@ -32,6 +36,10 @@ class Admin::NgWord
Setting.ng_words || []
end
def ng_words_for_stranger_mention
Setting.ng_words_for_stranger_mention || []
end
def post_hash_tags_max
value = Setting.post_hash_tags_max
value.is_a?(Integer) && value.positive? ? value : 0

View file

@ -38,6 +38,7 @@ class Form::AdminSettings
status_page_url
captcha_enabled
ng_words
ng_words_for_stranger_mention
hide_local_users_for_anonymous
post_hash_tags_max
sensitive_words
@ -91,6 +92,7 @@ class Form::AdminSettings
STRING_ARRAY_KEYS = %i(
ng_words
ng_words_for_stranger_mention
sensitive_words
sensitive_words_for_full
).freeze