comment cleanup

This commit is contained in:
Alan Roberts 2024-08-17 14:34:01 -04:00
parent 013f33b5d3
commit 6ab610c503
3 changed files with 1 additions and 18 deletions

View file

@ -178,24 +178,8 @@ class CreateImageForm(CreatePostForm):
class EditImageForm(CreatePostForm):
image_alt_text = StringField(_l('Alt text'), validators=[Optional(), Length(min=3, max=1500)])
# image_file = FileField(_l('Image'), validators=[DataRequired()], render_kw={'accept': 'image/*'})
def validate(self, extra_validators=None) -> bool:
# uploaded_file = request.files['image_file']
# if uploaded_file and uploaded_file.filename != '':
# Image.MAX_IMAGE_PIXELS = 89478485
# # Do not allow fascist meme content
# try:
# image_text = pytesseract.image_to_string(Image.open(BytesIO(uploaded_file.read())).convert('L'))
# except FileNotFoundError as e:
# image_text = ''
# if 'Anonymous' in image_text and (
# 'No.' in image_text or ' N0' in image_text): # chan posts usually contain the text 'Anonymous' and ' No.12345'
# self.image_file.errors.append(
# f"This image is an invalid file type.") # deliberately misleading error message
# current_user.reputation -= 1
# db.session.commit()
# return False
if self.communities:
community = Community.query.get(self.communities.data)
if community.is_local() and g.site.allow_local_image_posts is False:

View file

@ -605,7 +605,7 @@ def add_post(actor, type):
if community.posting_warning:
flash(community.posting_warning)
# empty post to pass since this extends edit_post.html
# empty post to pass since add_post.html extends edit_post.html
# and that one checks for a post.image_id for editing image posts
post = None

View file

@ -898,7 +898,6 @@ def post_edit(post_id: int):
elif post.type == POST_TYPE_LINK:
form = CreateLinkForm()
elif post.type == POST_TYPE_IMAGE:
# form = CreateImageForm()
form = EditImageForm()
elif post.type == POST_TYPE_VIDEO:
form = CreateVideoForm()