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
redisis not installed in the test environment. python frontend/manage.py checkandmakemigrations --check --dry-runpass.
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.pyaddsownerandsession_keyfields toFeed. - 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.
Activity
45:white_check_mark: Snyk checks have passed. No issues have been found so far.
| Status | Scan Engine | Critical | High | Medium | Low | Total (0) |
|---|---|---|---|---|---|---|
| :white_check_mark: | Open Source Security | 0 | 0 | 0 | 0 | 0 issues |
:computer: Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.
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.pyL1-27frontend/frontend/models.pyL1, 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.pyL2-16, L21-84frontend/frontend/urls.pyL25-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.pyL352-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.pyL7-22, L47-86 (+7 small edits)
Other changes
Files not grouped.
.circleci/config.ymlL7-17, L36-55.github/workflows/ci.ymlL15-34, L56-60frontend/frontend/locale/ru/LC_MESSAGES/django.poL199-306frontend/frontend/settings.py.exampleL78-81frontend/frontend/templates/base.htmlL66-91frontend/frontend/templates/frontend/edit_feed.htmlL1-56frontend/frontend/templates/frontend/myfeeds.htmlL1-56frontend/frontend/templates/frontend/preview.htmlL25-28frontend/frontend/templates/registration/login.htmlL1-35frontend/frontend/templates/registration/signup.htmlL1-34tests/test_accounts_feeds.pyL1-316frontend/frontend/locale/ru/LC_MESSAGES/django.mo
Tips and commands
Interacting with Sourcery
- Trigger a new review: Comment
@sourcery-ai reviewon 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 issueto create an issue from it. - Generate a pull request title: Write
@sourcery-aianywhere in the pull request title to generate a title at any time. You can also comment@sourcery-ai titleon the pull request to (re-)generate the title at any time. - Generate a pull request summary: Write
@sourcery-ai summaryanywhere in the pull request body to generate a PR summary at any time exactly where you want it. You can also comment@sourcery-ai summaryon the pull request to (re-)generate the summary at any time. - Generate reviewer's guide: Comment
@sourcery-ai guideon the pull request to (re-)generate the reviewer's guide at any time. - Resolve all Sourcery comments: Comment
@sourcery-ai resolveon 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 dismisson 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 reviewto 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
- Contact our support team for questions or feedback.
- Visit our documentation for detailed guides and information.
- Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.
Up to standards :white_check_mark:
🟢 Issues 0 issues
Results:
0new issues
🟢 Metrics 63 complexity · 0 duplication
Metric Results Complexity 63 Duplication 0
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.
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
Code Review Summary
Status: No Issues Found | Recommendation: Merge
Files Reviewed (13 files)
frontend/frontend/forms.pyfrontend/frontend/migrations/0011_feed_owner_session_key.pyfrontend/frontend/models.pyfrontend/frontend/settings.py.examplefrontend/frontend/templates/base.htmlfrontend/frontend/templates/frontend/edit_feed.htmlfrontend/frontend/templates/frontend/myfeeds.htmlfrontend/frontend/templates/frontend/preview.htmlfrontend/frontend/templates/registration/login.htmlfrontend/frontend/templates/registration/signup.htmlfrontend/frontend/urls.pyfrontend/frontend/views.pytests/test_accounts_feeds.py
Reviewed by free · Input: 53.9K · Output: 2.5K · Cached: 93.2K
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
| Comment | Fix |
|---|---|
| Title-only feeds blocked from saving | All field selectors are optional again; at least one field is required. A title-only regression test was added. |
| Malformed XPath breaks published feeds | Post 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 deletion | Legacy feeds must be claimed through the edit page before deletion. delete_feed no longer allows legacy claiming. |
| Concurrent legacy claims overwrite ownership | edit_feed reloads the row with select_for_update() inside the transaction and re-checks permission before saving. |
| Cross-site sign-out via GET | logout_view now rejects non-POST requests. The navbar already posts the sign-out form. |
| Feed edits reach private network hosts | The edit form validates the page URL with assert_public_url unless READER_ALLOW_PRIVATE is enabled. |
| CI skips every new test | Both CI jobs now provision PostgreSQL, migrate and load the fixture before pytest. |
| Russian pages show English labels | New 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-testspasses. python frontend/manage.py checkandmakemigrations --check --dry-runpass.
This pull request is a draft
Merging is unavailable until it is marked ready for review.
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
frontend/frontend/models.py,frontend/frontend/migrations/0011_feed_owner_session_key.py,frontend/frontend/views.pyFeedgains an optional user owner and session key. Feed creation records ownership from the request. Selector endpoints import result processing locally.frontend/frontend/forms.py,frontend/frontend/views.py,frontend/frontend/urls.py,frontend/frontend/settings.py.example,tests/test_accounts_feeds.pyfrontend/frontend/templates/base.html,frontend/frontend/templates/frontend/*,frontend/frontend/templates/registration/*Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Feature
Sequence Diagram(s)
Suggested reviewers:
taroved,openhands-agentMerge Risk: High · previous review
b875eAny 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
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)
Fix failing CI checks
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