massenergize / frontend-portal

Front End Code for the MassEnergize Community Portal. The community portal is customized for each participating community, and has the canonical URL https://community.massenergize.org/<community-name>/. For example, https://community.massenergize.org/wayland/.
MIT License
5 stars 2 forks source link

🌶️ Hot Fix: Issue with TOS and Policies page #1318

Closed frimpongopoku closed 4 months ago

frimpongopoku commented 4 months ago

What was wrong?

When the footer menu items are sent from the backend, they are sent with no leading slashes. They are sent like this:

        {
            "id": 9,
            "name": "PortalFooterQuickLinks",
            "content": {
                "links": [
                    {
                        "link": "policies?name=Privacy%20Policy",
                        "name": "Privacy Policy",
                        "navItemId": "footer-privacy-policy-id"
                    },
                    {
                        "link": "policies?name=Terms%20of%20Service",
                        "name": "Terms of Service",
                        "navItemId": "footer-terms-of-service-id"
                    },
                    {
                        "link": "https://docs.google.com/forms/d/e/1FAIpQLScxNPrJNsyy6k834hsPdy_Rf0jaDcczRAkjCM3Z1xgYn49Zsw/viewform",
                        "name": "Report a bug/Suggest a feature",
                        "navItemId": "footer-report-a-bug-id"
                    }
                ],
                "title": "Quick Links"
            },
            "is_deleted": false,
            "is_published": false
        },

When there is no leading slash, the link is appended to whatever is in the address bar; and when that happens while a user is using the site via a custom domain, the link that will be formed will not match anything defined in our AppRouter.js.

Case in point : https://www.energynavigators.org/testimonials/policies?name=Privacy%20Policy

Requirements

Transparency (Project board)

What kind of change does this PR introduce? (check at least one)

Does this PR introduce a breaking change? (check one)

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

Other information: Any otherthing we need to know