fix: review round 2 — Clear watch progress clears only the resume point, big view focus by the way it arrived, dialog name, reason tooltip, backfill locks
This commit is contained in:
@@ -204,22 +204,21 @@ def set_video_state(
|
||||
return {"ok": True, "video_id": video_id, "status": status}
|
||||
|
||||
|
||||
@router.delete("/videos/{video_id}/state")
|
||||
def clear_video_state(
|
||||
@router.delete("/videos/{video_id}/progress")
|
||||
def clear_video_progress(
|
||||
video_id: str,
|
||||
user: User = Depends(current_user),
|
||||
db: Session = Depends(get_db),
|
||||
) -> dict:
|
||||
"""Reset a video to pristine for this user — drop the whole VideoState row (status,
|
||||
watch position and watched_at), as if it had never been opened. Saved/playlist membership
|
||||
lives elsewhere and is untouched."""
|
||||
"""Forget where the user left a video: its resume point goes, its status (watched, hidden) stays.
|
||||
Saved/playlist membership lives elsewhere and is untouched."""
|
||||
try:
|
||||
service.clear_state(db, user, video_id)
|
||||
service.set_progress(db, user, video_id, 0)
|
||||
db.commit()
|
||||
# silent-ok: the row went under the delete, which is the outcome the delete wanted.
|
||||
# silent-ok: the row went under the write, which is the outcome the write wanted.
|
||||
except StaleDataError:
|
||||
db.rollback()
|
||||
return {"ok": True, "video_id": video_id, "status": "new", "position_seconds": 0}
|
||||
return {"ok": True, "video_id": video_id, "position_seconds": 0}
|
||||
|
||||
|
||||
@router.post("/videos/{video_id}/progress")
|
||||
|
||||
Reference in New Issue
Block a user