-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Feature Request
Problem / Opportunity
PR #10926 has been merged and some of the code needs to be refactored due to redundancy and accessibility issues.
The main issue that needs to be resolved is refactoring the code that implements following in the list cards. We need to prevent a redirect to the followed/unfollowed user's profile after the follow/unfollow button is clicked and the user follows/unfollows another user on the platform.
Proposal
Breakdown
Related files
In order to switch the List feature's follow button to be "async" (meaning submit and update the page without a reload), we will need to implement a solution in javascript and our js files live in:
https://github.com/internetarchive/openlibrary/tree/master/openlibrary/plugins/openlibrary/js
One option is to use Partials
Async Follow
An example for reference is the Reading Log "Check-in" which is the "when did you read this" form that shows up after you click "Already Read":
- We need to write some code that responds when the follow button is clicked
- It will need to make an ajax request similar to the check-in code directly above and, on success, update the Card's follow button. Alternatively, instead of trying to manually update the List card, we could effectively call a "partial" API to re-request this list as html and replace the existing component on the page.
- In our main index.js (for openlibrary), we'll need to check whether a
list-follow-cardexists on the page, and if so, instantiate the listcard.js file or whatever we call it e.g.module.initListCard.
Requirements Checklist
Checklist of requirements that need to be satisfied in order for this issue to be closed:
- Refactor $ owner_username.
- Switch to javascript to async submit "follow" action without reloading
- Resolve image text accessibility issue.
- Explore refactoring the
@publicget_user` method for something that exists- This is for fetching the user object of the owner of the list (as opposed to the current logged in user)
Stakeholders
Instructions for Contributors
- Before creating a new branch or pushing up changes to a PR, please first run these commands to ensure your repository is up to date, as the pre-commit bot may add commits to your PRs upstream.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status