Add post_hash_tags_max setting
This commit is contained in:
parent
650cfae270
commit
03dabcad9c
9 changed files with 26 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue