fix(feed): a filter on a deleted tag matches nothing and its chip says so

A saved view or the stored filter outlives its tag. feedquery dropped the unknown id, so the
view showed the whole feed under its old name. The id now lands in a MISSING_TAG_CATEGORY that
filters to nothing in the SQL and in feed_summary's mirror alike; the feed chip reads "Deleted
tag" (a placeholder while the tag list loads, the id if it failed). Channels' persisted tag
filter gets the same chip, first in the row so the +N overflow cannot fold it away.
This commit is contained in:
2026-10-03 21:53:05 +02:00
parent 52f12e5331
commit 8f1208fdfe
11 changed files with 190 additions and 26 deletions
+21
View File
@@ -168,9 +168,30 @@ _SUMMARY_CASES = [
"show=all&untagged=true&tags={L1}",
"show=all&q=clip",
"show=unwatched",
# A deleted tag's id (a saved view or the feed state still holds it) matches nothing.
"show=all&tags=987654",
"show=all&tags={L1}&tags=987654",
]
def test_a_deleted_tags_id_filters_to_nothing_not_to_everything(db, as_user, make_user):
"""A saved view or the feed's filter state keeps a tag id after the tag is deleted. The feed used
to drop an unknown id, so that view silently showed the WHOLE feed under its old name (E32 S2).
A filter on a tag that no longer exists matches nothing; the chip says the tag is gone."""
user, tag_ids = _seed_tagged(db, make_user)
client = as_user(user)
everything = client.get("/api/feed/count?show=all")
assert everything.status_code == 200
assert everything.json()["count"] == 8
for qs in ("show=all&tags=987654", f"show=all&tags={tag_ids['L1']}&tags=987654"):
r = client.get(f"/api/feed/count?{qs}")
assert r.status_code == 200
assert r.json()["count"] == 0, qs
r = client.get(f"/api/feed?{qs}")
assert r.status_code == 200
assert r.json()["items"] == [], qs
def test_untagged_filter_keeps_only_channels_the_user_has_not_tagged(db, as_user, make_user):
"""The "No tag" filter (item B): `untagged=true` keeps only channels with NO tag the USER personally
attached (no user-owned ChannelTag). System/auto tags (user_id NULL) don't count, and another user's