Remove folders; feeds are organized by tags now

Folders are gone — organization is tags-only, via the SubscriptionTag
model added last commit. A migration converts every existing Folder into
a same-named Tag applied to its feeds, and every folder-scoped FilterRule
into an equivalent tag-scoped one, before the Folder table is dropped, so
upgrading an existing instance loses nothing (verified by seeding the
pre-removal schema directly and running the migration chain against it).

Unlike folders, a feed can carry more than one tag, so:
- apps.articles.tasks.apply_filter_rules_for_feed and apps.rules.tasks's
  backlog re-apply now scope by "does this feed carry tag X" rather than
  "does this feed belong to folder X".
- apps.feeds.opml: a feed's tags export as a comma-separated "category"
  attribute (the standard OPML way to represent multiple categories)
  instead of nesting under one folder outline. Import reads both that
  attribute and nested category outlines, turning each enclosing level
  into its own tag rather than collapsing to the nearest one.
- The sidebar groups feeds by tag instead of folder, so a feed with two
  tags now appears in both groups; untagged feeds fall into "Untagged".

AddFeedForm gained a comma-separated tag_names field for parity with the
old add-time folder picker. EditSubscriptionForm dropped its folder
field entirely — tagging a subscription happens through the tag editor
already on that page.

Verified end to end: the migration chain from empty, the data migration
against a seeded pre-removal schema (folder/subscription/rule all convert
correctly), and the running app's sidebar grouping, OPML export category
attributes, and tag editor.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
ksmithandClaude Sonnet 5 committed 2026-10-30 21:30:06 -06:00
1 parent 3b58fdcb7e
commit 0e132e9ab9
24 files changed
+417 -307

No files matched your search

+3 -36
View File
@@ -3,7 +3,7 @@ from django.contrib.auth import get_user_model
from django.core.files.uploadedfile import SimpleUploadedFile
from django.urls import reverse
from .models import Feed, Folder, Subscription
from .models import Feed, Subscription
from .test_opml import SIMPLE_OPML
User = get_user_model()
@@ -39,50 +39,17 @@ def test_subscription_list_shows_only_own_subscriptions(client, alice, bob, alic
@pytest.mark.django_db
def test_edit_subscription_updates_title_and_folder(client, alice, alices_subscription):
def test_edit_subscription_updates_title(client, alice, alices_subscription):
client.login(username="alice", password="pw-alice-123")
folder = Folder.objects.create(user=alice, name="Tech")
response = client.post(
reverse("feeds:edit_subscription", args=[alices_subscription.pk]),
{"custom_title": "My Example Feed", "folder": folder.pk},
{"custom_title": "My Example Feed"},
)
assert response.status_code == 302
alices_subscription.refresh_from_db()
assert alices_subscription.custom_title == "My Example Feed"
assert alices_subscription.folder == folder
@pytest.mark.django_db
def test_edit_subscription_can_create_a_new_folder(client, alice, alices_subscription):
client.login(username="alice", password="pw-alice-123")
response = client.post(
reverse("feeds:edit_subscription", args=[alices_subscription.pk]),
{"custom_title": "", "folder": "", "new_folder_name": "Brand New Folder"},
)
assert response.status_code == 302
alices_subscription.refresh_from_db()
assert alices_subscription.folder.name == "Brand New Folder"
assert Folder.objects.filter(user=alice, name="Brand New Folder").count() == 1
@pytest.mark.django_db
def test_edit_subscription_can_clear_folder(client, alice, alices_subscription):
client.login(username="alice", password="pw-alice-123")
alices_subscription.folder = Folder.objects.create(user=alice, name="Tech")
alices_subscription.save()
response = client.post(
reverse("feeds:edit_subscription", args=[alices_subscription.pk]),
{"custom_title": "", "folder": ""},
)
assert response.status_code == 302
alices_subscription.refresh_from_db()
assert alices_subscription.folder is None
@pytest.mark.django_db