Mastodon Character Limit and Poll Options Increase for 4.5.1 on Yunohost

Increasing or Modifying the Character Limit

At our church Mastodon instance, the character limit is set to 5000 (up from the 500 originally allowed by Mastodon).

You will need to use the root account to modify these files. You can do this by SSH by issuing the following command in the terminal:

sudo su -

To customize this limit, you need to modify two files:

live/app/javascript/mastodon/features/compose/containers/compose_form_container.js – find the line that contains:

maxChars: state.getIn(['server', 'server', 'configuration', 'statuses', 'max_characters'], 500),

and change 500 to your desired value.

Next, you need to modify another file: live/app/validators/status_length_validator.rb – find the line that contains:

MAX_CHARS = 500

and change it accordingly.

To run the next command you will need to first issue this command:

sudo yunohost app shell mastodon

Once done, run the following command:

RAILS_ENV=production bundle exec rails assets:precompile

Exit the shell by typing:

exit

and restart the Mastodon services to apply the changes:

systemctl restart mastodon-web.service mastodon-sidekiq.service

Increasing or Modifying the Number of Poll Options

Edit the file live/app/validators/poll_options_validator.rb and modify the line:

MAX_OPTIONS = 4

to the value you want. There are also other customizable options in this file.

Again, once done, you will need to first issue this command:

sudo yunohost app shell mastodon

Once done, run the following command:

RAILS_ENV=production bundle exec rails assets:precompile

Exit the shell by typing:

exit

and restart the Mastodon services to apply the changes:

systemctl restart mastodon-web.service mastodon-sidekiq.service

These modifications might be overridden by subsequent Mastodon updates, so be sure to check after every update that they are still valid.