increase alt text max length

same as Lemmy and Mastodon
This commit is contained in:
rimu 2024-05-25 22:44:43 +12:00
parent 0eea7a2600
commit bbf345e689
3 changed files with 40 additions and 2 deletions

View file

@ -152,7 +152,7 @@ class CreateVideoForm(FlaskForm):
class CreateImageForm(FlaskForm):
communities = SelectField(_l('Community'), validators=[DataRequired()], coerce=int, render_kw={'class': 'form-select'})
image_title = StringField(_l('Title'), validators=[DataRequired(), Length(min=3, max=255)])
image_alt_text = StringField(_l('Alt text'), validators=[Optional(), Length(min=3, max=255)])
image_alt_text = StringField(_l('Alt text'), validators=[Optional(), Length(min=3, max=1500)])
image_body = TextAreaField(_l('Body'), validators=[Optional(), Length(min=3, max=5000)], render_kw={'rows': 5})
image_file = FileField(_l('Image'), validators=[DataRequired()])
tags = StringField(_l('Tags'), validators=[Optional(), Length(min=3, max=5000)])

View file

@ -204,7 +204,7 @@ class File(db.Model):
file_name = db.Column(db.String(255))
width = db.Column(db.Integer)
height = db.Column(db.Integer)
alt_text = db.Column(db.String(300))
alt_text = db.Column(db.String(1500))
source_url = db.Column(db.String(1024))
thumbnail_path = db.Column(db.String(255))
thumbnail_width = db.Column(db.Integer)

View file

@ -0,0 +1,38 @@
"""increase alt text length
Revision ID: 2191fa36c09d
Revises: dfba54bdaeb2
Create Date: 2024-05-25 22:43:40.203295
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '2191fa36c09d'
down_revision = 'dfba54bdaeb2'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('file', schema=None) as batch_op:
batch_op.alter_column('alt_text',
existing_type=sa.VARCHAR(length=300),
type_=sa.String(length=1500),
existing_nullable=True)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('file', schema=None) as batch_op:
batch_op.alter_column('alt_text',
existing_type=sa.String(length=1500),
type_=sa.VARCHAR(length=300),
existing_nullable=True)
# ### end Alembic commands ###