Add post_hash_tags_max setting

This commit is contained in:
KMY 2023-07-24 12:45:34 +09:00
parent 650cfae270
commit 03dabcad9c
9 changed files with 26 additions and 2 deletions

View file

@ -6,10 +6,23 @@ class Admin::NgWord
ng_words.any? { |word| text.include?(word) }
end
def hashtag_reject?(hashtag_count)
post_hash_tags_max.positive? && post_hash_tags_max < hashtag_count
end
def hashtag_reject_with_extractor?(text)
hashtag_reject?(Extractor.extract_hashtags(text)&.size || 0)
end
private
def ng_words
Setting.ng_words
end
def post_hash_tags_max
value = Setting.post_hash_tags_max
value.is_a?(Integer) && value.positive? ? value : 0
end
end
end