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