feat(telegram): candidate list/delete/clear commands

私聊新增 /candidate [页码](待决策列表)、/candi_del(标题按钮逐条删除,删后原地重建键盘、可翻页连续删)、/candi_clear(全部/待决策/取消)。重构 handle_callback 为前缀分派(cdel/cpage/cclr,保留 add/ign/blk/fav);repository 加 list_pending_candidates/delete_all_candidates;LibraryService 加 pending_candidates/delete_candidate/clear_candidates 并刷看板缓存。
This commit is contained in:
kairee committed 2026-11-01 20:45:57 +08:00
1 parent c6790f0ba1
commit 4a9c37f2f3
9 files changed
+473 -23

No files matched your search

+22
View File
@@ -180,11 +180,33 @@ def test_fav_action_state_machine():
db.close()
def test_list_pending_and_delete_all():
with tempfile.TemporaryDirectory() as tmp:
db, repo = setup(tmp)
try:
candidate(repo, 1, score=9)
candidate(repo, 2, score=4)
candidate(repo, 3, score=1)
repo.mark_candidate_decision(3, "rejected")
assert [c["aid"] for c in repo.list_pending_candidates()] == [1, 2]
assert repo.delete_all_candidates(pending_only=True) == 2
assert repo.get_candidate(3) is not None
assert repo.list_pending_candidates() == []
candidate(repo, 4)
assert repo.delete_all_candidates() == 2 # aid 3 + aid 4
assert repo.list_candidates() == []
finally:
db.close()
def main():
test_seen_and_known_aid()
test_candidate_upsert_preserves_decision_and_notified()
test_notify_and_reject_for_up()
test_delete_expired_candidates_only_pending()
test_list_pending_and_delete_all()
test_folder_for_up_uses_earliest_video()
test_fav_action_state_machine()
print("OK: 候选池、去重、通知记录与 fav_action 状态机测试全部通过")