api_call_signal. Route handler or application helper. This docstring was expanded to make future maintenance easier. Args: call_id: Parameter. Returns: Varies.
(call_id: int)
| 14085 | flash("User not found.") |
| 14086 | return redirect(url_for("chats")) |
| 14087 | |
| 14088 | has_chat_pin = _chat_lock_exists(me, "dm", username) |
| 14089 | chat_unlocked = _chat_lock_is_unlocked(me, "dm", username) |
| 14090 | peer_online = (True if username == me else is_online(username, g.scope)) |
| 14091 | if has_chat_pin and not chat_unlocked: |
| 14092 | conn.close() |
| 14093 | return render_template( |
| 14094 | "chat_locked.html", |
| 14095 | title=f"Chat {username}", |
| 14096 | me=me, |
| 14097 | peer=username, |
| 14098 | peer_display=peer_display, |
| 14099 | is_self_chat=is_self_chat, |
| 14100 | peer_online=peer_online, |
| 14101 | ) |
| 14102 | |
| 14103 | try: |
| 14104 | conn.execute(""" |
| 14105 | UPDATE dm_messages SET delivered_at=? |
| 14106 | WHERE sender=? AND recipient=? AND delivered_at IS NULL |
| 14107 | """, (now_z(), username, me)) |
| 14108 | conn.execute(""" |
| 14109 | UPDATE dm_messages SET read_at=? |
| 14110 | WHERE sender=? AND recipient=? AND read_at IS NULL |
| 14111 | """, (now_z(), username, me)) |
| 14112 | conn.commit() |
| 14113 | |
| 14114 | rows = conn.execute(""" |
| 14115 | SELECT id, sender, recipient, body_enc, created_at, delivered_at, read_at, has_voice, has_file, edited_at, deleted_at |
| 14116 | FROM dm_messages |
| 14117 | WHERE (sender=? AND recipient=?) OR (sender=? AND recipient=?) |
| 14118 | ORDER BY id ASC |
| 14119 | LIMIT 400 |
| 14120 | """, (me, username, username, me)).fetchall() |
| 14121 | except sqlite3.OperationalError: |
| 14122 | try: |
| 14123 | conn.close() |
| 14124 | except Exception: |
| 14125 | pass |
| 14126 | try: |
nothing calls this directly
no test coverage detected