List groups for the current user (with auto-heal schema).
()
| 14352 | if is_ajax: |
| 14353 | return jsonify(ok=False, error="File too large (max 33MB)."), 413 |
| 14354 | flash("File too large (max 33MB).") |
| 14355 | return redirect(url_for("chat_with", username=username)) |
| 14356 | if gif and getattr(gif, "filename", ""): |
| 14357 | gsz = _filestorage_size(gif) |
| 14358 | if gsz is not None and gsz > CHAT_MAX_BYTES: |
| 14359 | if is_ajax: |
| 14360 | return jsonify(ok=False, error="GIF too large (max 33MB)."), 413 |
| 14361 | flash("GIF too large (max 33MB).") |
| 14362 | return redirect(url_for("chat_with", username=username)) |
| 14363 | |
| 14364 | # Prefer an explicit file; otherwise accept GIF as a file attachment. |
| 14365 | chosen_file = ( |
| 14366 | upfile if (upfile and getattr(upfile, "filename", "")) else (gif if (gif and getattr(gif, "filename", "")) else None) |
| 14367 | ) |
| 14368 | |
| 14369 | if voice and getattr(voice, "filename", ""): |
| 14370 | try: |
| 14371 | _validate_chat_voice_upload(voice) |
| 14372 | except ValueError as ve: |
| 14373 | msg = "Unsupported voice file type." |
| 14374 | if str(ve) == "forbidden_type": |
| 14375 | msg = "Forbidden file type." |
| 14376 | if is_ajax: |
| 14377 | return jsonify(ok=False, error=msg), 400 |
| 14378 | flash(msg) |
| 14379 | return redirect(url_for("chat_with", username=username)) |
| 14380 | if chosen_file and getattr(chosen_file, "filename", ""): |
| 14381 | try: |
| 14382 | _validate_chat_file_upload(chosen_file) |
| 14383 | except ValueError as ve: |
| 14384 | msg = "Unsupported file type." |
| 14385 | if str(ve) == "forbidden_type": |
| 14386 | msg = "Forbidden file type." |
| 14387 | if is_ajax: |
| 14388 | return jsonify(ok=False, error=msg), 400 |
| 14389 | flash(msg) |
| 14390 | return redirect(url_for("chat_with", username=username)) |
| 14391 | |
| 14392 | has_voice = bool(voice and getattr(voice, "filename", "")) |
| 14393 | has_file = bool(chosen_file and getattr(chosen_file, "filename", "")) |
| 14394 | has_gif_url = bool(gif_url) |
| 14395 | |
| 14396 | if (not body) and (not has_voice) and (not has_file) and (not has_gif_url): |
| 14397 | if is_ajax: |
nothing calls this directly
no test coverage detected