#98

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

Draftashcoftwants to merge intofrom

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

Introduce account-backed feed management with session support, allowing users to save, discover, edit, claim, and delete their feeds.

New Features:

  • Add user registration, login, logout, and account navigation.
  • Add session- and account-based feed ownership with a My Feeds page for previewing, editing, and deleting feeds.
  • Add feed editing for source URLs, post selectors, and field selectors.
  • Allow users to claim anonymous or legacy feeds when signing up, logging in, or editing.

Bug Fixes:

  • Enable management of saved feeds that were previously read-only from their preview pages.
  • Prevent login redirects to untrusted external destinations.

Enhancements:

  • Expose feed-management actions according to the current visitor's ownership permissions.

Tests:

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

Chores:

  • Add database fields and migration for feed owners and anonymous session ownership.

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 by an anonymous browser session, and session-owned feeds are claimed automatically when the 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) listing the visitor's feeds 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.
  • Claiming a legacy feed (created before accounts existed) by editing it transfers ownership to the signed-in user.
  • 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.

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.

Written for commit b875e3ec36a810c5781ff1a4a34723f248c80772. Summary will update on new commits.


This change is 

Activity

45
coderabbitai[bot]51m ago

WARNING

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 23 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 29397a93-f3e2-457a-85fc-fadef1983ca1
Commits

Reviewing files that changed from the base of the PR and between b875e3ec36a810c5781ff1a4a34723f248c80772 and b3ff374c8ee2979e250b63221dd538b9c34650b7.

Files selected for processing: 13

  • .circleci/config.yml
  • .github/workflows/ci.yml
  • frontend/frontend/forms.py
  • frontend/frontend/locale/ru/LC_MESSAGES/django.mo
  • frontend/frontend/locale/ru/LC_MESSAGES/django.po
  • frontend/frontend/templates/base.html
  • frontend/frontend/templates/frontend/edit_feed.html
  • frontend/frontend/templates/frontend/myfeeds.html
  • frontend/frontend/templates/frontend/preview.html
  • frontend/frontend/templates/registration/login.html
  • frontend/frontend/templates/registration/signup.html
  • frontend/frontend/views.py
  • tests/test_accounts_feeds.py
Walkthrough

The change adds user and browser-session ownership for feeds, account signup and login, and feed listing, editing, and deletion. It also adds account and feed-management pages, routes, settings, and tests.

Changes: Feed ownership and account management

Layer / File(s)Summary
Feed ownership and creation
frontend/frontend/models.py, frontend/frontend/migrations/0011_feed_owner_session_key.py, frontend/frontend/views.py
Feed gains an optional user owner and session key. Feed creation records ownership from the request. Selector endpoints import result processing locally.
Feed management and account flow
frontend/frontend/forms.py, frontend/frontend/views.py, frontend/frontend/urls.py, frontend/frontend/settings.py.example, tests/test_accounts_feeds.py
Forms and views add feed listing, editing, deletion, signup, login, and logout. Signup and login claim matching session feeds. Login redirects only to an allowed destination. Routes, settings, and tests cover the flows.
Account and feed pages
frontend/frontend/templates/base.html, frontend/frontend/templates/frontend/*, frontend/frontend/templates/registration/*
Templates add account navigation, signup and login forms, a feed list and edit page, and preview controls based on edit permission.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Browser
  participant login_view
  participant Feed
  participant DjangoAuth
  Browser->>login_view: Submit credentials and session
  login_view->>Feed: Claim matching ownerless session feeds
  login_view->>DjangoAuth: Authenticate credentials
  login_view-->>Browser: Redirect to an allowed destination

Suggested reviewers: taroved, openhands-agent

Merge Risk: High · previous review b875e

Any signed-in user can take over or delete feeds that anonymous visitors created in other browsers, because the new management check treats them as legacy ownerless feeds. Concurrent claims of legacy feeds can also overwrite each other, and GET logout allows forced sign-out. Fix the authorization check before merging.

Pre-merge checks: 4

Check nameStatusExplanation
Description CheckCheck skipped - CodeRabbit’s high-level summary is enabled.
Title checkThe title "Add accounts, My Feeds list, and feed re-editing" matches the main changes in the changeset. The diff adds signup, login, and logout views and forms, a My Feeds page with Preview, Edit, and…
Linked Issues checkCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes checkCheck skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "Add accounts, My Feeds list, and feed re-editing" matches the main changes in the changeset. The diff adds signup, login, and logout views and forms, a My Feeds page with Preview, Edit, and Delete actions, and an edit page for existing feeds. It also adds the owner and session_key fields on Feed with migration 0011. The title is short, names the primary changes, and does not use vague terms.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
Fix failing CI checks

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

snyk-io[bot]51m ago

:white_check_mark: Snyk checks have passed. No issues have been found so far.

StatusScan Engine Critical High Medium LowTotal (0)
:white_check_mark:Open Source Security0000 0 issues

:computer: Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

sourcery-ai[bot]51m ago

Reviewer's Guide

Schema and migrations

Add nullable user ownership and indexed session ownership to feeds, with a migration that preserves existing feeds as unowned legacy records.

  • frontend/frontend/migrations/0011_feed_owner_session_key.py L1-27
  • frontend/frontend/models.py L1, L9-14

API

Define the account and feed-management routes, plus forms that validate feed URLs and XPath selectors and expose the editable feed fields.

  • frontend/frontend/forms.py L2-16, L21-84
  • frontend/frontend/urls.py L25-31

Implement the account and feed-management endpoints, including feed creation ownership, listing, editing, deletion, login redirect validation, and legacy-feed claiming.

  • frontend/frontend/views.py L352-481

Implementation

Add shared ownership and access-control helpers, and thread the request through feed creation so newly created feeds are assigned to a user or browser session.

  • frontend/frontend/views.py L7-22, L47-86 (+7 small edits)

Other changes

Files not grouped.

  • .circleci/config.yml L7-17, L36-55
  • .github/workflows/ci.yml L15-34, L56-60
  • frontend/frontend/locale/ru/LC_MESSAGES/django.po L199-306
  • frontend/frontend/settings.py.example L78-81
  • frontend/frontend/templates/base.html L66-91
  • frontend/frontend/templates/frontend/edit_feed.html L1-56
  • frontend/frontend/templates/frontend/myfeeds.html L1-56
  • frontend/frontend/templates/frontend/preview.html L25-28
  • frontend/frontend/templates/registration/login.html L1-35
  • frontend/frontend/templates/registration/signup.html L1-34
  • tests/test_accounts_feeds.py L1-316
  • frontend/frontend/locale/ru/LC_MESSAGES/django.mo

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an issue from a review comment by replying to it. You can also reply to a review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull request title to generate a title at any time. You can also comment @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in the pull request body to generate a PR summary at any time exactly where you want it. You can also comment @sourcery-ai summary on the pull request to (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the pull request to resolve all Sourcery comments. Useful if you've already addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull request to dismiss all existing Sourcery reviews. Especially useful if you want to start fresh with a new review - don't forget to comment @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

codacy-production[bot]50m ago

Up to standards :white_check_mark:

🟢 Issues 0 issues

Results: 0 new issues

View in Codacy

🟢 Metrics 63 complexity · 0 duplication

MetricResults
Complexity63
Duplication0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer TIP This summary will be updated as you push new changes.

sourcery-ai[bot]49m ago

Sorry @ashcoft, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 2 days and 19 hours by commenting @sourcery-ai review. Upgrade to get a review now.

mergify[bot]49m ago

Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.

  • Queue this pull request once it meets the queue conditions
kilo-code-bot[bot]49m ago

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (13 files)
  • frontend/frontend/forms.py
  • frontend/frontend/migrations/0011_feed_owner_session_key.py
  • frontend/frontend/models.py
  • frontend/frontend/settings.py.example
  • frontend/frontend/templates/base.html
  • frontend/frontend/templates/frontend/edit_feed.html
  • frontend/frontend/templates/frontend/myfeeds.html
  • frontend/frontend/templates/frontend/preview.html
  • frontend/frontend/templates/registration/login.html
  • frontend/frontend/templates/registration/signup.html
  • frontend/frontend/urls.py
  • frontend/frontend/views.py
  • tests/test_accounts_feeds.py

Reviewed by free · Input: 53.9K · Output: 2.5K · Cached: 93.2K

devin-ai-integration[bot]reviewed47m ago
devin-ai-integration[bot]reviewed47m ago
devin-ai-integration[bot]reviewed14m ago
devin-ai-integration[bot]reviewed14m ago
devin-ai-integration[bot]reviewed14m ago
devin-ai-integration[bot]reviewed14m ago
devin-ai-integration[bot]reviewed14m ago
devin-ai-integration[bot]reviewed14m ago
devin-ai-integration[bot]reviewed14m ago
devin-ai-integration[bot]reviewed14m ago
ashcoft9m ago

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

CI failure fixed

The Python tests job failed because the preview view started querying the database, while the existing test_preview_page_only_links_http_urls test runs without a database. The preview view is now database-free again.

Both CI systems now prepare a PostgreSQL database and load the field fixture before running the tests, so the new database-backed tests actually run instead of skipping:

  • GitHub Actions python-tests: PostgreSQL 19 service, migrate, loaddata fields.json.
  • CircleCI python-tests: PostgreSQL 19 service, wait-for-database step, migrate, loaddata fields.json.

Review comments addressed

CommentFix
Title-only feeds blocked from savingAll field selectors are optional again; at least one field is required. A title-only regression test was added.
Malformed XPath breaks published feedsPost and field XPath values are compiled with lxml.etree.XPath before saving; invalid values stay on the form with an error. Tests cover invalid post and field selectors.
Anonymous feed takeover across accounts_can_manage now requires the matching browser session for session-owned feeds. A signed-in user cannot claim or delete another browser's anonymous feed.
Unclaimed legacy feeds open to deletionLegacy feeds must be claimed through the edit page before deletion. delete_feed no longer allows legacy claiming.
Concurrent legacy claims overwrite ownershipedit_feed reloads the row with select_for_update() inside the transaction and re-checks permission before saving.
Cross-site sign-out via GETlogout_view now rejects non-POST requests. The navbar already posts the sign-out form.
Feed edits reach private network hostsThe edit form validates the page URL with assert_public_url unless READER_ALLOW_PRIVATE is enabled.
CI skips every new testBoth CI jobs now provision PostgreSQL, migrate and load the fixture before pytest.
Russian pages show English labelsNew labels and messages use translation tags/gettext, Russian translations were added, and django.mo was recompiled.

Verification

  • pytest -q tests/ --ignore=tests/e2e → 280 passed, 2 skipped (the skips are the existing Redis cache tests because Redis is not installed locally).
  • GitHub Actions: Python tests, Lint, Docker build, Playwright E2E, CodeQL and Codacy all pass.
  • CircleCI python-tests passes.
  • python frontend/manage.py check and makemigrations --check --dry-run pass.

This pull request is a draft

Merging is unavailable until it is marked ready for review.