Add accounts, My Feeds list, and feed re-editing

AS
5m ago
+999-17

This PR was created by an AI agent (OpenHands) on behalf of the user.

Problem

The deployed site could not re-edit a saved feed (for example /en/preview/4). The preview page is read-only, there is no /setup/<id> edit route, and feeds were anonymous, so there was no concept of a user's feed list. The site also had no signup/login routes.

Changes

  • Add signup, login and logout views, forms, URLs and templates.
  • Add a user menu to the navbar (My Feeds, username, Sign out) plus Sign up / Log in links for anonymous visitors.
  • Attach each feed to a user, or to the browser session for anonymous visitors.
  • Add a My Feeds page (/en/myfeeds) listing the current user's feeds with Preview, Edit and Delete actions.
  • Add a feed edit page (/en/setup/<feed_id>) for the page URL, post XPath and per-field XPaths.
  • Show Edit feed on the preview page when the visitor may manage the feed, or Sign in to edit otherwise.
  • Claim session-owned feeds when a visitor signs up or logs in.
  • Allow a signed-in user to claim a legacy feed (created before accounts existed) by editing it; once claimed it stays private.
  • Add migration 0011_feed_owner_session_key.py.
  • Add tests covering signup, login, open-redirect protection, My Feeds, editing, ownership checks and anonymous feed creation.

Testing

  • pytest -q tests/ --ignore=tests/e2e → 273 passed, 2 skipped
  • The two skips are the existing Redis cache tests because redis is not installed in the test environment.
  • python frontend/manage.py check and makemigrations --check --dry-run pass.

Deployment note

Existing feeds have no owner. After deploying and running the migration, a signed-in user can open a legacy feed's preview, click Edit feed, and that claims the feed so it appears in My Feeds.

@ashcoft can click here to continue refining the PR

Summary by Sourcery

Enable account-based feed management with anonymous session ownership, feed listing, and saved-feed editing.

New Features:

  • Add user signup, login, logout, feed ownership, session-based anonymous feeds, and feed management workflows.
  • Provide My Feeds and feed editing pages with preview, edit, and delete actions.
  • Allow users to claim legacy feeds and automatically transfer session-owned feeds when signing up or logging in.

Bug Fixes:

  • Restore the ability to edit saved feeds while enforcing ownership and safe redirect checks.

Enhancements:

  • Validate feed URLs and XPath selectors when editing feeds, and require POST for destructive or session-ending actions.

CI:

  • Run database-backed tests against a prepared PostgreSQL service in CircleCI and GitHub Actions.

Tests:

  • Add coverage for account flows, feed ownership, anonymous feed creation, editing, claiming, deletion, validation, and redirect protection.

Chores:

  • Add the feed ownership and anonymous session key migration.

Summary by cubic

Adds user accounts, a My Feeds page, and the ability to edit saved feeds. Feeds can now be owned by a user or an anonymous browser session, and session-owned feeds are claimed automatically when a visitor signs up or logs in.

  • Adds signup, login, and logout views with a user menu in the navbar.
  • Adds a My Feeds page (/en/myfeeds) with Preview, Edit, and Delete actions, plus a feed edit page at /en/setup/<feed_id>.
  • Shows an Edit feed link on the preview page when the visitor can manage that feed; otherwise shows Sign in to edit.
  • Claims a legacy feed (created before accounts existed) by editing it, transferring ownership to the signed-in user.
  • Session-owned feeds require the matching browser session to edit or delete, so signed-in users cannot take them.
  • Requires a legacy feed to be claimed before deletion, and locks the feed row so two users cannot claim it at once.
  • Requires POST for logout and delete, and validates post and field XPath syntax before saving.
  • Migration 0011_feed_owner_session_key.py adds owner and session_key fields to Feed.
  • Tests cover signup, login, open-redirect protection, ownership checks, editing, and anonymous feed creation, and CI now prepares a PostgreSQL database so they run.

Migration note

Existing feeds have no owner. After deploying, a signed-in user can open a legacy feed's preview and click Edit feed to claim it; it then appears in My Feeds.


This change is Reviewable

Summary by CodeRabbit

  • New Features
    • Added account registration, sign-in, and sign-out, with account links in the navigation.
    • Added a “My feeds” page to preview, edit, and delete feeds.
    • Added feed editing for source URLs and field selectors, including required-field indicators.
    • Feeds created before signing in can be associated with an account after registration or sign-in. Anonymous visitors can manage feeds in their current browser session.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; the latest change preserves access checks and returns the expected 403 response.

Summary

Adds accounts, browser-session feed ownership, My Feeds, and saved-feed editing.

  • Accounts and browser sessions keep feeds attached to their owners.
  • Feed owners can find, edit, and delete their saved feeds.
  • CI prepares PostgreSQL before running the database-backed tests.

Reviews (3) · Last reviewed commit: "Use PermissionDenied for feed access err..." · Reviewed by Greptile