Fix: "Clear my history" now clears account history too
clearSession only reset the device-local history; for a signed-in user the panel shows the account history (serverHistory), which was never cleared and never sent to the server — so it looked like nothing happened. Add DELETE /api/history (clear all) and have clearSession reset serverHistory + call it when signed in.
This commit is contained in:
@@ -563,6 +563,14 @@ def create_app() -> FastAPI:
|
||||
conn.commit()
|
||||
return {"ok": True}
|
||||
|
||||
@app.delete("/api/history")
|
||||
def clear_history(request: Request) -> dict:
|
||||
with get_conn() as conn:
|
||||
user = _require_user(conn, request)
|
||||
conn.execute("DELETE FROM user_history WHERE user_id = ?", (user["id"],))
|
||||
conn.commit()
|
||||
return {"ok": True}
|
||||
|
||||
@app.delete("/api/history/{article_id}")
|
||||
def remove_history(article_id: int, request: Request) -> dict:
|
||||
with get_conn() as conn:
|
||||
|
||||
Reference in New Issue
Block a user