-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Accept comments argument in showSelectedPost #11606
Conversation
Currently when clicking on a comment link in a stream we are passing a `comments` attribute to `showSelectedPost` (via an object), however we aren’t destructuring it and are doing nothing with it. This commit adds `comments` to the arguments destructuring in `showSelectedPost` and then passes the argument down to `showFullPost`, which already supports and is smart enough to add `#comments` to the URL. As a result, now clicking on a the comments link in any card takes us to the comments section of the post, not the title. There are some limited tests, too. Fixes #10951.
|
||
it( 'redirects if passed a post key', () => { | ||
showSelectedPost( { postKey: { feedId: 1, postId: 5 } } ); | ||
expect( pageSpy ).to.have.been.calledOnce; |
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.
may be good to verify that the url does not have "#comments" here
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.
Agreed. I wanted to hear your thoughts on refactoring this a bit before adding a lot more tests. This suite is missing many other branches of the code.
Thank you @nb for addressing this! Code looks great. I love the tests :) |
On your design notes: |
Functionality is still broken for cards in the SearchStream. I'll plop in a commit with a fix |
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
@blowery wouldn’t it have been better if we had squashed the commits in this case? The search stream change doesn’t seem logically separate from the first one. |
@nb I tend to avoid squashing when there are multiple authors |
helps to preserve blame info down the road |
Fixes #10951 – when clicking the Comments link on a card in the reader it doesn’t take us to the comments section of a post.
Implementation details are in the commit message.
A couple of design notes:
page
this deep the call chain was unexpected for me. It would’ve felt a lot more natural ifpage
calls were limited to actions/controllers, or at least to components, not library functions.