Add: #577 メンション数上限設定を、メンションされた全てのローカルアカウントが相手をフォローしている場合、そうでない場合で分けられるように (#578)

This commit is contained in:
KMY(雪あすか) 2024-02-17 11:05:29 +09:00 committed by GitHub
parent 9a3c8c5bda
commit a6b5e64e15
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 163 additions and 8 deletions

View file

@ -34,6 +34,14 @@ class Admin::NgWord
mention_reject?(text.gsub(Account::MENTION_RE)&.count || 0)
end
def stranger_mention_reject_with_count?(mention_count)
post_stranger_mentions_max.positive? && post_stranger_mentions_max < mention_count
end
def stranger_mention_reject_with_extractor?(text)
stranger_mention_reject_with_count?(text.gsub(Account::MENTION_RE)&.count || 0)
end
private
def include?(text, word)
@ -62,6 +70,11 @@ class Admin::NgWord
value.is_a?(Integer) && value.positive? ? value : 0
end
def post_stranger_mentions_max
value = Setting.post_stranger_mentions_max
value.is_a?(Integer) && value.positive? ? value : 0
end
def record!(type, text, keyword, options)
return unless options[:uri] && options[:target_type]
return if options.key?(:public) && !options.delete(:public)