The default of 500 might be too low.
The default of 500 might be too low.
The customization is tested and works for Mastodon 4.1.1
1. Increase maximum toot length from 500 to 700 characters
As mastodon:
cd ~/live
cp -p app/javascript/mastodon/features/compose/components/compose_form.js app/javascript/mastodon/features/compose/components/compose_form.js.orig
cp -p app/validators/status_length_validator.rb app/validators/status_length_validator.rb.orig
cp -p app/serializers/rest/instance_serializer.rb app/serializers/rest/instance_serializer.rb.orig
sed -i 's/500/700/g' app/javascript/mastodon/features/compose/components/compose_form.js
sed -i 's/500/700/g' app/validators/status_length_validator.rb
sed -i 's/:registrations/:registrations, :max_toot_chars /g' app/serializers/rest/instance_serializer.rb
sed -i 's/private/def max_toot_chars\n 700\n end\n\n private/g' app/serializers/rest/instance_serializer.rb
RAILS_ENV=production bundle exec rails assets:precompile && echo "pass" || echo "fail"
As root:
service mastodon-web reload
2. Before upgrades, revert customization (otherwise “git checkout” will complain)
As mastodon:
cd ~/live
cp -p app/javascript/mastodon/features/compose/components/compose_form.js.orig app/javascript/mastodon/features/compose/components/compose_form.js
cp -p app/validators/status_length_validator.rb.orig app/validators/status_length_validator.rb
cp -p app/serializers/rest/instance_serializer.rb.orig app/serializers/rest/instance_serializer.rb
3. After upgrade, just repeat “Implement customization” again
With v4.3.x of Mastodon, there are now only 2 files you need to change:
app/validators/status_length_validator.rb
and
spec/validators/note_length_validator_spec.rb