Changing mastodon character limits

Why?

Sometimes you have more to say. Here’s how to do it.

Docker stuff

If you’re on docker, you need to change your docker-compose.yml and set your web image to build. This is because we’re gonna be changing some files manually, because Eugen doesn’t want to make them ENV variables.

The modifications required

  1. Edit the file: app/javascript/mastodon/features/compose/components/compose_form.js
    Find every instance of the number 500 (the current character limit) and change it to however many characters you want.

  2. Next file: app/validators/status_length_validator.rb
    Change the single instance of the number 500 (the current character limit) to your new character count.

  3. Finally, edit app/serializers/rest/instance_serializer.rb
    You’ll want to change the line starting with: :languages, :registrations,
    to include: :languages, :registrations, :max_toot_chars,
    Its okay if there’s other text afterwards, you just want max_toot_chars after registrations

  4. Above where it says private (around line 66?), you’ll want to paste:

def max_toot_chars  
  <the actual number of characters you want your character limit to be>  
end  

What did I just do?

The first two files control how many characters you have, the changes to the last one help to inform any apps that support alternate character limits what your new limits are.

Final steps

Docker specifics

Finally, you need to run docker-compose build. It will take a while, as it needs to compile your web image.

Restart your insrance

Start/Restart your mastodon node in the normal way and enjoy your new character limit!

.

Related Articles