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

Fix automatic 'setIncludeHighlights' + handle errors from highlights token request (ELES-1237) #777

Conversation

egargan-ft
Copy link
Contributor

@egargan-ft egargan-ft commented May 13, 2024

This PR fixes a couple of issues related to the 'share with highlights' feature.

Currently, whenever a user selects "FT subscribers only", even if the article contains no highlights for the user, we still request a highlights access token.

Whenever the user selected "FT subscribers only", we setIncludeHighlights to the value of the "Anyone/FT subscribers only" switcher, which evaluates to true. This is an issue particularly when the article contains no highlights, as we don't display the 'Include Highlights' checkbox, but we're still setting it to true.

This PR makes sure that we're only setting includeHighlights when the user wishes to.

It also adds some error handling to the code that requests the highlights token. Currently this endpoint does not return an error, but it soon will in an upcoming change to the Highlights backend, where the /create-token route will return 404 when the given article contains no highlights.

@egargan-ft egargan-ft requested a review from a team as a code owner May 13, 2024 14:28
@egargan-ft egargan-ft force-pushed the ELES-1237-fix-no-highlights-handling branch from 22998da to 30599fe Compare May 13, 2024 14:28
@egargan-ft egargan-ft changed the title Fix automatic 'includeHighlights' + don't fetch token when no highlights present (ELES-1237) Fix automatic 'setIncludeHighlights' + handle errors from highlights token request (ELES-1237) May 13, 2024
@egargan-ft egargan-ft force-pushed the ELES-1237-fix-no-highlights-handling branch from 30599fe to 9477365 Compare May 13, 2024 14:32
Copy link
Contributor

@GlynnPhillips GlynnPhillips left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the helpful description on the why

@egargan-ft egargan-ft merged commit 97b1bd9 into Financial-Times:main May 14, 2024
2 checks passed
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.

5 participants