Table of Contents
Shameless Advert
Join our open fedi relay! relay.disobey.net
Shameless Complaint
Why doesn't Mastodon gGmbH allow admins to change this in the GUI admin panel?
Introduction
I run the disobey.net and nautical.social Mastodon instances and I very much dislike the max character limitations in posts (toots) and in my profile bio(s). I've documented the changes i've made to increase the limits from 500 to 2000. I self-host Mastodon on a standalone server built from source, not Docker.
- Mastodon v4.2.x needs steps 1 - 4 below.
- Mastodon v4.3.0 needs steps 1 and 4 only.
Mastodon v4.3.x notes
- When updating Mastodon from v4.3.0-beta.1 to v4.3.0-beta.2, and from v4.3.0-beta.2 to v4.3.0-rc.1, I needed to "git stash" or "git reset --hard HEAD" my changes before updating. Then I needed to manually re-apply these max character count changes.
- When updating from v4.3.0-beta.2 to v4.3.0-rc.1, I found that step 3 is no longer needed when reapplying these changes.
- It appears that after completing the final step, specifically the restart, the UI displaying "500" takes about a minute to refresh to the updated number (like "2000" in my example).
- (NEW) When updating from v4.3.0-rc.1 to v4.3.0, I did not need to reapply these changes. They stuck, i didn't even need to "git stash" or "git reset --hard HEAD".
Mastodon changes
All file editing below is from my Mastodon root directory, "~/live". Pay attention to any of my lines below that specify "2000", it used to say the default "500":
Post increase
Step 1
vim app/validators/status_length_validator.rb
class StatusLengthValidator < ActiveModel::Validator
MAX_CHARS = 2000
URL_PLACEHOLDER_CHARS = 23
URL_PLACEHOLDER = 'x' * 23
Step 2
Step 2 is not needed in Mastodon v4.3.0-rc.1! Only steps 1 and 4 are needed. Skip to step 4.
vim app/javascript/mastodon/features/compose/components/compose_form.jsx
canSubmit = () => {
const { isSubmitting, isChangingUpload, isUploading, anyMedia } = this.props;
const fulltext = this.getFulltextForCharacterCounting();
const isOnlyWhitespace = fulltext.length !== 0 && fulltext.trim().length === 0;
return !(isSubmitting || isUploading || isChangingUpload || length(fulltext) > 2000 || (isOnlyWhitespace && !anyMedia));
};
and in the same compose_form.jsx file:
<div className='character-counter__wrapper'>
<CharacterCounter max={2000} text={this.getFulltextForCharacterCounting()} />
</div>
</div>
</div>
Profile bio increase
Step 3
Step 3 is not needed in Mastodon v4.3.0-rc.1! Only steps 1 and 4 are needed. Skip to step 4.
vim app/views/settings/profiles/show.html.haml
.fields-row
.fields-row__column.fields-row__column-6
.fields-group
= f.input :display_name, wrapper: :with_block_label, input_html: { maxlength: 30, data: { default: @account.username } }
.fields-group
= f.input :note, wrapper: :with_block_label, input_html: { maxlength: 2000 }
Step 4
vim app/models/account.rb
# Local user validations
....
validates :note, note_length: { maximum: 2000 }, if: -> { local? && will_save_change_to_note? }
....
Finally
As the mastodon user:
RAILS_ENV=production bundle exec rails assets:precompile
As root user:
systemctl restart mastodon-web mastodon-sidekiq mastodon-streaming