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
|
||||
|
|
|
@ -37,12 +37,14 @@ class Form::AdminSettings
|
|||
ng_words
|
||||
enable_block_emoji_reaction_settings
|
||||
hide_local_users_for_anonymous
|
||||
post_hash_tags_max
|
||||
).freeze
|
||||
|
||||
INTEGER_KEYS = %i(
|
||||
media_cache_retention_period
|
||||
content_cache_retention_period
|
||||
backups_retention_period
|
||||
post_hash_tags_max
|
||||
).freeze
|
||||
|
||||
BOOLEAN_KEYS = %i(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue