-
Couldn't load subscription status.
- Fork 3
Subscription management page #1331
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
Conversation
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.
This generally works well thought I noticed a couple issues.
Styling: Doesn't quite match figma in terms of spacing and, in a couple places, font sizes. Apologies we don't have a more immediately useable ListItem for you.
Functionality: I noticed some issues around url encoding. Note that we started url encoding search filters for channels in #1326 because new topic names have ampersands. I noticed two things:
- On the new subscripts page, channels subscriptions to topics with ampersands aren't compared correctly to the original search. I believe the immediate solution is to NOT
unquote_plusthe search filter. - Topics with commas in their name can't be subscriped to.
- this bug exists on
main, but imo makes sense to fix here. I believegetSearchParamMapshould NOT split on commas.
- this bug exists on
It seems to me that (1) and (2) above might both be easier if we stored search_filter—both for channels and for subscription queries—as objects rather than encoded strings, but that seems longer term.
Co-authored-by: Chris Chudzicki <christopher.chudzicki@gmail.com>
Co-authored-by: Chris Chudzicki <christopher.chudzicki@gmail.com>
for more information, see https://pre-commit.ci
|
@ChristopherChudzicki this is ready to be looked at again |
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.
Works and looks great. Noticed a small issue with borders.
I also think it would be worth adding a simple frontend test, along the lines of
// SettingsPage.test.tsx
import React from "react"
import { SettingsPage } from "./SettingsPage"
import { renderWithProviders } from "@/test-utils"
describe("SettingsPage", () => {
it("Renders user subscriptions in a list", () => {
})
test("Clicking 'Unfollow' removes the subscription", () => {
})
})Co-authored-by: Chris Chudzicki <christopher.chudzicki@gmail.com>
Co-authored-by: Chris Chudzicki <christopher.chudzicki@gmail.com>
for more information, see https://pre-commit.ci
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.
👍 LGTM
| renderWithProviders(<SettingsPage />) | ||
|
|
||
| const followList = await screen.findByTestId("follow-list") | ||
| const unsubscribeButton = within(followList).getAllByText("Unfollow")[0] |
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 try to use getByRole* for most things, since it effectively adds an assertion about the role in the accessibility treat. E.g., if we know it's an element with role link, it's almost certainly tab-navigable[^1]
| const unsubscribeButton = within(followList).getAllByText("Unfollow")[0] | |
| const unsubscribeButton = within(followList).getAllByRole("link", { name: "Unfollow" })[0] |
[^1] I say "almost certainly" because it's probably an anchor tag. If someone did <div role="link" /> (don't!), that would show up as a link in the browser's accessibility treat, but wouldn't be tab navigable.
What are the relevant tickets?
Closes https://github.com/mitodl/hq/issues/4891
Description (What does it do?)
Adds a "Preferences" page to the dashboard that contains a list of channels a user has subscribed to (from which they can unsubscribe)
Screenshots (if appropriate):
How can this be tested?
Additional context
Functionally the unsubscribe buttons on this preferences page are the same as if you unsubscribed directly from the relevant channel's page. We are just consolidating all the subscriptions in one location here.