·332 words
This is mostly a note to myself, but hopefully useful to others too. Here’s how to increase the post character limit on a Mastodon server. Bonus: how to increase the number of poll options as well.
First, a disclaimer: these changes may be reset during an update, and you’ll have to redo them. That’s exactly why I’m writing this down for myself. This works at least in the latest versions!
Unfortunately, neither of these settings are in the .env.production file — they need to be changed directly in the code. So if you’re not sure what you’re doing, don’t make these changes. I take no responsibility if you break something!
Increasing the character limit #
This requires editing two files. You can use the nano editor for this. In nano, CTRL + O saves and CTRL + X closes the editor.
Switch to the mastodon user (sudo su - mastodon) and navigate to the /home/mastodon/live directory.
First, edit the compose_form_container.js file:
nano app/javascript/mastodon/features/compose/containers/compose_form_container.js
Find the line where maxChars is defined and change the value to your desired character count. The default is 500.
maxChars: state.getIn(['server', 'server', 'configuration', 'statuses', 'max_characters'], 500),
The second file to edit is status_length_validator.rb:
nano app/validators/status_length_validator.rb
Find the MAX_CHARS line and set it to the same value you used above. The default is 500.
MAX_CHARS = 500
After that, you need to recompile the assets with the following command:
RAILS_ENV=production bundle exec rails assets:precompile
Then restart the Mastodon processes:
sudo systemctl stop 'mastodon-*.service'
sudo systemctl start 'mastodon-*.service' --all
If everything went as expected, you should now see the new character limit when composing a post!
Bonus: Increasing the number of poll options #
If you also want more than 4 options in polls, you can change that in the poll_options_validator.rb file:
nano app/validators/poll_options_validator.rb
Find the MAX_OPTIONS line and change it to your desired number of options. The default is 4.
MAX_OPTIONS = 4
This article was first published on my blog in Finnish.
Article image by Rolf van Root on Unsplash

Comments
Nothing yet. Say the first thing.
Sign in to join the conversation.