(scope: str, q: str = "")
| 18632 | conn.close() |
| 18633 | |
| 18634 | class Obj: |
| 18635 | def __init__(self, d): |
| 18636 | self.__dict__.update(d) |
| 18637 | |
| 18638 | return render_template( |
| 18639 | "discussion.html", |
| 18640 | title="Discussion", |
| 18641 | items=[Obj(x) for x in items], |
| 18642 | q=q_raw, |
| 18643 | me=me, |
| 18644 | ) |
| 18645 | |
| 18646 | |
| 18647 | @app.route("/discussion/send", methods=["POST"]) |
| 18648 | @login_required |
| 18649 | def discussion_send(): |
| 18650 | """Send a discussion message (text, file, GIF, and/or voice).""" |
| 18651 | _feature_tables_init() |
| 18652 | me = current_user() |
| 18653 | |
| 18654 | is_ajax = ( |
| 18655 | request.headers.get("X-Requested-With") == "XMLHttpRequest" |
| 18656 | or "application/json" in (request.headers.get("Accept", "")) |
| 18657 | ) |
| 18658 | |
| 18659 | body = (request.form.get("body") or "").strip() |
| 18660 | voice = request.files.get("voice") |
| 18661 | upfile = request.files.get("file") |
| 18662 | gif = request.files.get("gif") |
| 18663 | gif_url = (request.form.get("gif_url") or "").strip() |
| 18664 | |
| 18665 | # Size limits (33MB) for chat stability. |
| 18666 | if voice and getattr(voice, "filename", ""): |
| 18667 | vsz = _filestorage_size(voice) |
| 18668 | if vsz is not None and vsz > CHAT_MAX_BYTES: |
no test coverage detected