api_locations. Route handler or application helper. This docstring was expanded to make future maintenance easier. Returns: Varies.
()
| 14273 | {% endif %} |
| 14274 | </div> |
| 14275 | <div class="msg-meta"> |
| 14276 | <span class="ts" data-utc="{{ m.created_at_utc }}">{{ m.created_at_local }}</span>{% if m.deleted %} • deleted{% endif %} |
| 14277 | {% if m.sender==me %} |
| 14278 | {% if m.read_at_local %} • seen <span class="ts" data-utc="{{ m.read_at_utc }}">{{ m.read_at_local }}</span>{% else %} • sent{% endif %} |
| 14279 | {% endif %} |
| 14280 | </div> |
| 14281 | </div> |
| 14282 | """ |
| 14283 | |
| 14284 | _GROUP_ROW_TEMPLATE = r""" |
| 14285 | <div class="mb-2" data-gmid="{{ m.id }}"> |
| 14286 | <div class="bubble {{ 'me' if m.sender==me else 'them' }}"> |
| 14287 | {% if m.kind == "text" %} |
| 14288 | <div class="small-muted mb-1">{{ m.sender }}</div> |
| 14289 | {{ m.body }} |
| 14290 | {% else %} |
| 14291 | <div class="small-muted mb-1">{{ m.sender }} • Voice</div> |
| 14292 | <audio controls preload="metadata" style="width:100%"> |
| 14293 | <source src="{{ url_for('group_voice_stream', vid=m.voice_id) }}" type="{{ m.voice_mime }}"> |
| 14294 | </audio> |
| 14295 | {% endif %} |
| 14296 | </div> |
| 14297 | <div class="msg-meta {{ 'text-end' if m.sender==me else '' }}"><span class="ts" data-utc="{{ m.created_at_utc }}">{{ m.created_at_local }}</span></div> |
| 14298 | </div> |
| 14299 | """ |
| 14300 | |
| 14301 | |
| 14302 | def _render_dm_row_html(m: Dict[str, Any], me: str) -> str: |
| 14303 | """Render one DM message row to HTML for AJAX updates.""" |
| 14304 | return render_template_string(_DM_ROW_TEMPLATE, m=m, me=me) |
| 14305 | |
| 14306 | |
| 14307 | @app.route("/chat/<username>/send", methods=["POST"]) |
| 14308 | @login_required |
| 14309 | def dm_send(username: str): |
| 14310 | """Send a DM message (text, file, GIF, and/or voice). |
| 14311 | |
| 14312 | Important stability notes: |
| 14313 | - The message and its attachments are committed atomically (single DB transaction), |
| 14314 | so other clients never see a "blank" placeholder that requires refresh. |
nothing calls this directly
no test coverage detected