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

Strip HTML in excerpt field and adjust test data #1418

Merged
merged 1 commit into from May 12, 2022

Conversation

ulliholtgrave
Copy link
Member

@ulliholtgrave ulliholtgrave commented May 11, 2022

Short description

This PR adds a functionality to strip the HTML entities in the excerpt field and adjust the test data accordingly.

Resolved issues

Fixes: #1410

@ulliholtgrave ulliholtgrave requested a review from a team as a code owner May 11, 2022 22:37
Copy link
Member

@timobrembeck timobrembeck left a comment

Choose a reason for hiding this comment

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

Thanks, works as expected! 👍
Is there a reason you didn't use the inbuilt Django functionality?

from django.utils.html import strip_tags

excerpt": strip_tags(page_translation.content),

I feel like a custom html parser is a bit overkill for this task...
Apart from that: could you add a note to the changelog?

@codeclimate
Copy link

codeclimate bot commented May 12, 2022

Code Climate has analyzed commit f00872f and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 73.5% (0.0% change).

View more on Code Climate.

@ulliholtgrave
Copy link
Member Author

@timoludwig You are right, i just missed this inbuild method and changed it accordingly. I also added a Changelog entry and fixed all the test cases (which was a hell of a job 🙈 )

Copy link
Member

@timobrembeck timobrembeck left a comment

Choose a reason for hiding this comment

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

Awesome, thanks! 👍
If you want, you can also change the commit message to more accurately reflect what the commit does.

@ulliholtgrave ulliholtgrave changed the title Add custom ExcerptCreator and use it within the API reponses Strip HTML in excerpt field and adjust test data May 12, 2022
@ulliholtgrave ulliholtgrave merged commit ce20613 into develop May 12, 2022
@ulliholtgrave ulliholtgrave deleted the bugfix/excerpt_creation branch May 12, 2022 08:48
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.

HTML entities not stripped in excerpt
2 participants