(eid: int)
| 15732 | v = conn.execute("SELECT id, mime FROM group_voice WHERE gm_id=? ORDER BY id DESC LIMIT 1", (r["id"],)).fetchone() |
| 15733 | has_voice = bool(v) |
| 15734 | try: |
| 15735 | body = aesgcm_decrypt_text(r["body_enc"]) |
| 15736 | except Exception: |
| 15737 | body = "[decrypt failed]" |
| 15738 | messages.append({ |
| 15739 | "id": r["id"], |
| 15740 | "sender": r["sender"], |
| 15741 | "kind": "voice" if has_voice else "text", |
| 15742 | "body": body if not has_voice else "", |
| 15743 | "created_at_local": _local_time_str(r["created_at"]), |
| 15744 | "created_at_utc": r["created_at"], |
| 15745 | "voice_id": v["id"] if v else None, |
| 15746 | "voice_mime": v["mime"] if v else "audio/webm" |
| 15747 | }) |
| 15748 | |
| 15749 | conn.close() |
| 15750 | |
| 15751 | return render_template("group_chat.html", title="Group chat", |
| 15752 | g=Obj(g_row), my_role=role, members=[type("M", (), m)() for m in members], |
| 15753 | all_users=all_usernames(), me=me, messages=messages, has_group_pin=has_group_pin) |
| 15754 | |
| 15755 | @app.route("/groups/<int:gid>/send", methods=["POST"]) |
| 15756 | @login_required |
| 15757 | def group_send(gid: int): |
| 15758 | """Send a group message (text and/or voice) without forcing a page refresh when called via AJAX. |
| 15759 | |
| 15760 | Stability: |
nothing calls this directly
no test coverage detected