You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The idea behind this feature is that a user can indicate their interest in a variety of different things, and we'll notify them when a new document is added that is linked to that thing.
Conceptually, there are two aspects:
the user can choose to follow (or unfollow) a thing
we periodically check for documents with a "creation" date after the last alert was sent for the "thing", and send emails accordingly
Models that can be followed:
Author
Country (jurisdiction)
Locality
CourtClass
Court
CourtRegistry
TaxonomyTopic
More can readily be added later.
Proposal
UX
Following
On the detail page for each thing to be followed, a new button is added (bell) Follow XXX or (bell) Unfollow XXX.
The button is loaded dynamically by htmx just like the "save" button for documents, so that caching isn't impacted.
Endpoint: GET /account/following/button?taxonomy=10 (where the query params have the thing being followed and the PK
If the user is logged in, it checks if the user is following the thing and returns a follow or unfollow button as appropriate.
If the user is NOT logged in, it shows a follow button that shows the login modal (similar to search alerts).
Clicking the follow button sends a POST that sets up the following and redirects to the button url, to change the button to unfollow.
Endpoint: POST /account/following/follow?taxonomy=10
Endpoint: POST /account/following/unfollow?taxonomy=10
Because the buttons are standalone, we can later add them to any part of any page. For example, a judgment detail page could have a "Follow" button alongside the court name.
User profile
A new tab is added to the User profile page called "Following", that lists the things that the user is following, and includes an unfollow button. The behaviour of the button can be exactly the same as above. This would mean if the user accidentally unfollows, the entry is still there but now with a Follow button. If they refresh the page, it's gone.
Endpoint: GET /account/following
Emails
Sending one email per day reduces the number of emails sent. It could look a bit like this:
Dear Greg,
We've found new documents for areas that you're following.
High Court
----------
1. Foo
2. Bar
3. Baz
Education
---------
1. Boom
2. Baz
Manage what you're following (link)
Best,
The LII team
Backend
A new UserFollowing model:
user: FK
court: FK
taxonomy_topic: FK
etc (see below)
created_at: timestamp
last_alerted_at: timestamp
Each UserFollowing model is linked to a user, and one of a wide variety of things that can be followed. It's better to use explicit foreign keys rather than Django's generic foreign keys, because when we're checking for new documents we need to know exactly what we're checking for. It also means we know exactly what things can be followed.
A daily background task wakes up and queues up new background tasks for each user that has UserFollowing models. The task for each user:
gathers all the documents that are new for each UserFollowing instance
combines them into a single email, grouped by the thing being followed
sends the email (if any)
updates the last_alerted_at timestamp on each UserFollowing instance
The text was updated successfully, but these errors were encountered:
The idea behind this feature is that a user can indicate their interest in a variety of different things, and we'll notify them when a new document is added that is linked to that thing.
Conceptually, there are two aspects:
Models that can be followed:
More can readily be added later.
Proposal
UX
Following
On the detail page for each thing to be followed, a new button is added
(bell) Follow XXX
or(bell) Unfollow XXX
.The button is loaded dynamically by htmx just like the "save" button for documents, so that caching isn't impacted.
GET /account/following/button?taxonomy=10
(where the query params have the thing being followed and the PKIf the user is logged in, it checks if the user is following the thing and returns a follow or unfollow button as appropriate.
If the user is NOT logged in, it shows a follow button that shows the login modal (similar to search alerts).
Clicking the follow button sends a POST that sets up the following and redirects to the button url, to change the button to unfollow.
POST /account/following/follow?taxonomy=10
POST /account/following/unfollow?taxonomy=10
Because the buttons are standalone, we can later add them to any part of any page. For example, a judgment detail page could have a "Follow" button alongside the court name.
User profile
A new tab is added to the User profile page called "Following", that lists the things that the user is following, and includes an unfollow button. The behaviour of the button can be exactly the same as above. This would mean if the user accidentally unfollows, the entry is still there but now with a Follow button. If they refresh the page, it's gone.
GET /account/following
Emails
Sending one email per day reduces the number of emails sent. It could look a bit like this:
Backend
A new UserFollowing model:
Each UserFollowing model is linked to a user, and one of a wide variety of things that can be followed. It's better to use explicit foreign keys rather than Django's generic foreign keys, because when we're checking for new documents we need to know exactly what we're checking for. It also means we know exactly what things can be followed.
A daily background task wakes up and queues up new background tasks for each user that has UserFollowing models. The task for each user:
The text was updated successfully, but these errors were encountered: