make status reaction count limit configurable
This commit is contained in:
parent
16e4a10cb4
commit
953ee687ef
|
@ -269,6 +269,9 @@ MAX_POLL_OPTIONS=5
|
||||||
# Maximum allowed poll option characters
|
# Maximum allowed poll option characters
|
||||||
MAX_POLL_OPTION_CHARS=100
|
MAX_POLL_OPTION_CHARS=100
|
||||||
|
|
||||||
|
# Maximum number of emoji reactions per toot and user (minimum 1)
|
||||||
|
MAX_STATUS_REACTIONS=8
|
||||||
|
|
||||||
# Maximum image and video/audio upload sizes
|
# Maximum image and video/audio upload sizes
|
||||||
# Units are in bytes
|
# Units are in bytes
|
||||||
# 1048576 bytes equals 1 megabyte
|
# 1048576 bytes equals 1 megabyte
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
class StatusReactionValidator < ActiveModel::Validator
|
class StatusReactionValidator < ActiveModel::Validator
|
||||||
SUPPORTED_EMOJIS = Oj.load_file(Rails.root.join('app', 'javascript', 'mastodon', 'features', 'emoji', 'emoji_map.json').to_s).keys.freeze
|
SUPPORTED_EMOJIS = Oj.load_file(Rails.root.join('app', 'javascript', 'mastodon', 'features', 'emoji', 'emoji_map.json').to_s).keys.freeze
|
||||||
|
|
||||||
LIMIT = 8
|
LIMIT = [1, (ENV['MAX_STATUS_REACTIONS'] || 1).to_i].max
|
||||||
|
|
||||||
def validate(reaction)
|
def validate(reaction)
|
||||||
return if reaction.name.blank?
|
return if reaction.name.blank?
|
||||||
|
|
Reference in New Issue