Skip to content
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

Update support forum ratings component #406

Closed
wants to merge 7 commits into from

Conversation

StevenDufresne
Copy link
Contributor

This PR updates the support forum reviews stars & bars to use the shared component.

Related: WordPress/wporg-mu-plugins#633, #380

Important

The forums display more precise rating numbers, while the new components round ratings to the nearest 0.5. Since we already use the new components in multiple places, if we want to keep the current precision, we should do it everywhere at once in the new components.

Considerations

The ratings-stars and ratings-bars components expect the context to contain postId. However, based on how bbPress works and how it's been modified, the postId is not set.

As a result, I've made use of the render_block_context block to set it. we still don't use that in wporg_set_rating_data, as we need to call wporg_support_get_compat_object to get all the relevant data. It feels a bit silly, but feels better than the alternative. The alternative would be to change the blocks to not return if the post_id is not set. That feels less predictable.

I've also done some minor styling updates.

Screenshots

Before After
Screenshot 2024-10-25 at 12 08 11 PM Screenshot 2024-10-25 at 11 52 50 AM
Screenshot 2024-10-25 at 11 49 34 AM Screenshot 2024-10-25 at 11 53 09 AM

@StevenDufresne StevenDufresne requested a review from ryelle October 25, 2024 03:39
@StevenDufresne StevenDufresne changed the title Try/support ratings Update support forum ratings component Oct 25, 2024
@bazza bazza closed this Oct 25, 2024
@bazza bazza deleted the try/support-ratings branch October 25, 2024 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants