-
Notifications
You must be signed in to change notification settings - Fork 20
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
Fix various bugs on comment counters and pagination #133
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Discourse is very peculiar when it comes to what it counts as a "reply", so in order to get a current, sensible count we must just count all posts and subtract one, for the original post.
The button was disappearing in dark mode The alignment was also off And the color was changing on hover in Firefox
If the `forum_link` property was present on a post but had no value, the "Leave a reply" button would be rendered but not be a link (since we have no href). So let's check for any valid `forum_link` instead of just not undefined
The latest posts was missing a link to its discussion in the forums
So users know they're clickable
Being stuck on the bottom of the page is bad usability, so scroll all the way back up so users can check out the posts
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
gkoscky
changed the title
#127: Fix various bugs on comment counters and pagination
Fix various bugs on comment counters and pagination
Oct 6, 2023
deadpine
approved these changes
Nov 29, 2023
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!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This contains a series of small fixes addressing problems with the "comment counter" under posts in the blog
Comments
Badges saying "Leave a reply" for posts that already had comments
We figure out if there are any comments on a post by querying the associated topic in our Discourse Collective. Unfortunately a bad CORS setting in Discourse was blocking the requests coming from the blog.
Just needed to change the
Access-Control-Allow-Origin
setting fromhttps://writings.flashbots.com
tohttps://writings.flashbots.net
Comment counts were off by one
Discourse doesn't really give you a direct way to get the number of replies under a Topic. We were using the
posts_count
, but that's the total number of posts and not replies so we needed to subtract one - the original post - from that count.CSS fixes
The button was disappearing in Dark Mode. The SVG bubble has better alignment. And link color is no longer changing on hover for Firefox.
Don't render the comment button if there's no Collective post
The "Leave a Reply" button could be rendered if the post had a
forum_link
property set to empty. So now there's better handling of that caseNavigation
Change the cursor to a click-hand on navigation links
Better UX, so the user knows they're clickable
Scroll up to first post on page change
Previously changing the page would leave the page stuck at the bottom, so the user would have to scroll back up to see the posts and potentially have to scroll all the way back down to go to the next page.
Make it so that the page automatically scrolls up when you change the page
Fixes: #127