Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make alt text limit an .env parameter #16

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

sneakers-the-rat
Copy link
Collaborator

Alt text should be able to be one million characters long. This pull requests lets the alt text limit be set from .env as MAX_ALT_TEXT_CHARS (defaulting to the current 1500.

Mastodon image description window describing a green bordered image with italic text that says 'alt text character limits should be one million'

Also added to /api/instance and /api/v1/instance

JSON response from the /api/instance endpoint that shows a new field max_alt_text_characters in configuration.media_attachments

Alt text config implementation:

  • Set in .env (with example in .env.production.sample)
  • Set in Rails in MediaAttachment model as MAX_DESCRIPTION_LENGTH by reading from ENV
  • Read by Rails in initial_state_serializer and instance_serializer for both v1 and v2 apis
  • Transferred to js from initialState as maxAltTextChars
  • Used in focal_point_modal to display.

API Changes:

  • /api/v1/instance
    • max_alt_text_characters
    • configuration.media_attachments.max_alt_text_characters
  • /api/instance
    • configuration.media_attachments.max_alt_text_characters

Also fixed an unexplained reversion in mastodon@71f2b95 that invalidates alt text that is longer than the local limit.

Alt text config implementation:
- Set in .env (with example in .env.production.sample)
- Set in Rails in `MediaAttachment` model as `MAX_DESCRIPTION_LENGTH` by reading from ENV
- Read by Rails in `initial_state_serializer` and `instance_serializer` for both v1 and v2 apis
- Transferred to js from initialState as `maxAltTextChars`
- Used in focal_point_modal to display.

API Changes:
- `/api/v1/instance`
  - `max_alt_text_characters`
  - `configuration.media_attachments.max_alt_text_characters`
- `/api/instance`
  - `configuration.media_attachments.max_alt_text_characters`
Copy link

This pull request has merge conflicts that must be resolved before it can be merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant