Adds an optional usage tracking feature that helps users find their most frequently accessed bookmarks. This feature is privacy-focused and disabled by default.#1157
Open
dafal wants to merge 1 commit intosissbruecker:masterfrom
Conversation
|
This is neat. I wonder what happens when this feature is enabled and a not-logged-in user clicks on a shared bookmark? |
Implements an optional usage tracking feature that allows users to track how often they click on bookmarks and sort by "Most Used". The feature uses a proper join table (BookmarkUsage) to track per-user statistics, ensuring privacy and data isolation between users. Key Features: - Privacy-first: Disabled by default, requires opt-in - Per-user tracking: Each user has their own usage statistics via BookmarkUsage model - Works everywhere: Tracks both owned bookmarks and shared bookmarks - Secure: Anonymous users never see the "Most Used" option - Isolated data: Usage counts are user-specific, no data leakage Implementation Details: - New BookmarkUsage model with (bookmark, user) unique constraint - Visit endpoint tracks clicks and increments counter atomically - "Most Used" sort option uses subquery to current user's usage data - Conditional UI: Option only appears when user is authenticated and has tracking enabled - Template uses visit URL when tracking is enabled, direct URL otherwise Database Changes: - Add BookmarkUsage table with bookmark_id, user_id, access_count, last_accessed - Add enable_usage_tracking boolean to UserProfile (default False) - Index on (user, -access_count) for efficient sorting Security: - @login_required on visit endpoint - is_authenticated check before showing sort option - Subquery filters BookmarkUsage by current user only - Anonymous users see standard sort options only Documentation: - Updated README.md with feature description - Added comprehensive how-to guide in docs/how-to.md - Documented privacy guarantees and user controls 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Author
@philiplb Thanks for catching that issue! I've completely redesigned the implementation based on your feedback. I replaced single access_count field with a BookmarkUsage join table so usage is per user. For anonymous users, it is simply disabled. |
|
How nice! :D |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
BookmarkUsagejoin table to track per-user click countsenable_usage_trackinguser setting (disabled by default)/bookmarks/<id>/visit/endpoint for click trackingPrivacy & Design
Note
Uses a join table architecture instead of a single counter to properly handle multiple users. Addresses feedback about non-authenticated users viewing shared bookmarks.
Key changes from original: