mirror of
https://github.com/jointakahe/takahe.git
synced 2025-02-16 15:45:14 +00:00
Limit shortcodes on emoji to Mastodon rules
This commit is contained in:
parent
cfb4975fdf
commit
536f0a4488
1 changed files with 5 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from django.core.validators import RegexValidator
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.shortcuts import redirect
|
from django.shortcuts import redirect
|
||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
|
@ -46,7 +47,10 @@ class EmojiCreate(FormView):
|
||||||
|
|
||||||
class form_class(forms.Form):
|
class form_class(forms.Form):
|
||||||
shortcode = forms.SlugField(
|
shortcode = forms.SlugField(
|
||||||
help_text="What users type to use the emoji :likethis:",
|
help_text="What users type to use the emoji :likethis:\nShould only contain 0-9, a-z and underscores",
|
||||||
|
validators=[
|
||||||
|
RegexValidator(r"^[a-z0-9_]+$", message="Invalid emoji shortcode")
|
||||||
|
],
|
||||||
)
|
)
|
||||||
image = forms.ImageField(
|
image = forms.ImageField(
|
||||||
help_text=f"The emoji image\nShould be at least 40 x 40 pixels, and under {settings.SETUP.EMOJI_MAX_IMAGE_FILESIZE_KB}KB",
|
help_text=f"The emoji image\nShould be at least 40 x 40 pixels, and under {settings.SETUP.EMOJI_MAX_IMAGE_FILESIZE_KB}KB",
|
||||||
|
|
Loading…
Reference in a new issue