-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add follow button to patron profile pages #9374
Add follow button to patron profile pages #9374
Conversation
@@ -1,9 +1,12 @@ | |||
$def with (page) | |||
|
|||
$var title: $page.displayname | |||
$ username = page.key.split('/')[-1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a safer way to get this, such as from get_users_settings
? Or is this way of doing it considered pretty safe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be okay in this case.
Other than my open question in the files listing, I have two more:
|
Really nice work @pidgezero-one! re: your questions above:
A few edge cases for us to consider:
When I am logged in and go to https://testing.openlibrary.org/people/brewster, I see the correct thing: When I am logged out, I don't: Also, when I try to click
On /people/brewster/books it works correctly where, once I follow, I see unfollow btn Test Checklist
|
@mekarpeles Thank you! :) I've pushed another commit that addresses these issues, and have updated my screenshots in the PR description according to the checklist provided. |
Closes #9358
Adds a follow button to a user's patron page.
Technical
is_subscribed
check business logic fromMyBooksTemplate
to the user level so that it can also be leveraged by the patron page. This seems like an appropriate place for it IMO as the user model also includes other object reference checks likeis_usergroup_member
.Testing
I added a test patron via the provided instructions.
(The rest of my testing steps are outlined in the Screenshots section)
Screenshot
Viewing my own page: no follow button (public or private)
Viewing a public patron while logged in: follow button appears
Click the follow button: it becomes an unfollow button
Viewing a public patron logged out / incognito: follow button appears
Clicking the follow button while logged out prompts a login
After changing the test user's reading log to public, no button appears, logged in or logged out;
Stakeholders
@mekarpeles
Attribution Disclaimer: By proposing this pull request, I affirm to have made a best-effort and exercised my discretion to make sure relevant sections of this code which substantially leverage code suggestions, code generation, or code snippets from sources (e.g. Stack Overflow, GitHub) have been annotated with basic attribution so reviewers & contributors may have confidence and access to the correct context to evaluate and use this code.