Compare commits

...

10 Commits

Author SHA1 Message Date
Zee Aslam
dff14feb49
Merge 036eefcc94 into 94bceb8683 2025-07-11 14:05:42 +00:00
Zee Aslam
036eefcc94
Merge branch 'main' into fix-10609-poll-options 2025-07-02 22:57:00 -04:00
Zee Aslam
06af2d2bc3
Merge branch 'main' into fix-10609-poll-options 2025-07-01 12:39:21 -04:00
Zee Aslam
491686db20
Merge branch 'main' into fix-10609-poll-options 2025-06-30 17:14:04 -04:00
Zee Aslam
f5e6722627
Merge branch 'main' into fix-10609-poll-options 2025-06-29 19:58:51 -04:00
Zee Aslam
0e66f139c8
Merge branch 'main' into fix-10609-poll-options 2025-06-26 12:17:40 -04:00
Zee Aslam
aa6a77fa1b
Update poll_options_validator.rb
Fix defaults to upstream mastodon values instead of glitch-soc
2025-06-25 19:08:28 -04:00
Zee Aslam
553642b43f
Merge branch 'main' into fix-10609-poll-options 2025-06-25 15:35:42 -04:00
Zee Aslam
9b9e3dd453
Update .env.production.sample 2025-06-25 14:25:12 -04:00
Zee Aslam
1761ae6ab0
Update poll_options_validator.rb 2025-06-25 14:22:46 -04:00
2 changed files with 8 additions and 2 deletions

View File

@ -109,3 +109,9 @@ FETCH_REPLIES_MAX_SINGLE=500
# Max number of replies Collection pages to fetch - total
FETCH_REPLIES_MAX_PAGES=500
# Maximum allowed poll options
MAX_POLL_OPTIONS=4
# Maximum allowed poll option characters
MAX_POLL_OPTION_CHARS=50

View File

@ -1,8 +1,8 @@
# frozen_string_literal: true
class PollOptionsValidator < ActiveModel::Validator
MAX_OPTIONS = 4
MAX_OPTION_CHARS = 50
MAX_OPTIONS = (ENV['MAX_POLL_OPTIONS'] || 4).to_i
MAX_OPTION_CHARS = (ENV['MAX_POLL_OPTION_CHARS'] || 50).to_i
def validate(poll)
poll.errors.add(:options, I18n.t('polls.errors.too_few_options')) unless poll.options.size > 1