From 80b1f10fc5240301bef8d0f0570a97751f54ef6c Mon Sep 17 00:00:00 2001 From: Benature Date: Sun, 29 Nov 2026 20:47:55 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=BF=87=E6=BB=A4=E6=9D=83=E9=99=90?= =?UTF-8?q?=E5=8F=98=E6=9B=B4=E9=80=9A=E7=9F=A5=EF=BC=8C=E4=B8=8D=E5=86=99?= =?UTF-8?q?=E5=85=A5=E7=9B=B8=E5=85=B3=E6=99=BA=E8=83=BD=E7=BA=AA=E8=A6=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VERSION | 2 +- snooper_calendar.py | 11 +++++++++-- tests/test_calendar.py | 17 ++++++++++++++--- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/VERSION b/VERSION index b005e30..9097948 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.2.15 +0.2.16 diff --git a/snooper_calendar.py b/snooper_calendar.py index 23c2e23..3d9fe2b 100644 --- a/snooper_calendar.py +++ b/snooper_calendar.py @@ -43,6 +43,11 @@ def _extract_topic(text: str) -> str: return match.group(1).strip() if match else "" +def _drop_permission_change(links: list[dict[str, Any]]) -> list[dict[str, Any]]: + """Permission-change notices carry no title and are not new minutes.""" + return [link for link in links if "permission_change" not in link["url"]] + + def fetch_ai_notes_links( client: Any, target_day: date, @@ -104,10 +109,12 @@ def fetch_ai_notes_links( # If we found links locally, return them sorted if links: links.sort(key=lambda x: x["create_time"]) - return links + return _drop_permission_change(links) # Otherwise pull from network - return _fetch_ai_notes_links_from_network(client, target_day, tz, chat_id, storage) + return _drop_permission_change( + _fetch_ai_notes_links_from_network(client, target_day, tz, chat_id, storage) + ) def _fetch_ai_notes_links_from_network( diff --git a/tests/test_calendar.py b/tests/test_calendar.py index f111001..c908c72 100644 --- a/tests/test_calendar.py +++ b/tests/test_calendar.py @@ -48,15 +48,26 @@ def test_fetch_ai_notes_links_reads_topic_from_local_content(): ), }) - links = fetch_ai_notes_links( - object(), date(2026, 11, 17), tz, storage=storage - ) + links = fetch_ai_notes_links(object(), date(2026, 11, 17), tz, storage=storage) assert len(links) == 1 assert links[0]["url"].startswith("https://efund.feishu.cn/minutes/abc123") assert links[0]["topic"] == "指数-金科定期AI业务讨论会" +def test_permission_change_links_are_dropped(): + from snooper_calendar import _drop_permission_change + + links = [ + {"url": "https://efund.feishu.cn/minutes/m1?from_source=permission_change"}, + {"url": "https://efund.feishu.cn/minutes/m2?from_source=finish_recording"}, + ] + kept = _drop_permission_change(links) + assert [link["url"] for link in kept] == [ + "https://efund.feishu.cn/minutes/m2?from_source=finish_recording" + ] + + class FakeCalendarClient: def __init__(self): self.calls = []