Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: Remove "No newline" from previews #222

Merged
merged 1 commit into from
Oct 3, 2022

Conversation

IstoraMandiri
Copy link
Contributor

@IstoraMandiri IstoraMandiri commented Oct 3, 2022

This PR is a fix for #217 and possibly address #153 (comment).

When generating the preview, the parse-diff library is used to get the contents of new tweets, but was including \\ No newline at end of file for new .tweet files that are affected.

This PR filters out lines in the diff that do not start with +, ensuring that only additional lines are actually included in the text of the parsed tweet.

Perhaps there is a better approach to fixing than this PR, but the parse-diff library does not provide many options. If the diff passed to parseDiff is fully escaped (i.e. \\\\ No newline at end of file), the library does remove this line from the list of additional lines.

I have included a test case that uses the diff output from a sample run of of a newline tweet: https://github.com/IstoraMandiri/twitter-together-testing/actions/runs/3172702318/jobs/5167466385#step:2:8

Preview before this PR https://github.com/IstoraMandiri/twitter-together-testing/runs/8672961177

Preview after this PR https://github.com/IstoraMandiri/twitter-together-testing/runs/8672999162

@IstoraMandiri IstoraMandiri marked this pull request as draft October 3, 2022 09:15
@IstoraMandiri IstoraMandiri marked this pull request as ready for review October 3, 2022 09:19
@MattIPv4 MattIPv4 self-requested a review October 3, 2022 13:05
Copy link
Member

@MattIPv4 MattIPv4 left a comment

Choose a reason for hiding this comment

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

LGTM

@MattIPv4 MattIPv4 requested a review from gr2m October 3, 2022 15:12
Copy link
Contributor

@gr2m gr2m left a comment

Choose a reason for hiding this comment

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

great PR 👍🏼

@gr2m gr2m merged commit 1baaa61 into twitter-together:main Oct 3, 2022
@gr2m
Copy link
Contributor

gr2m commented Oct 3, 2022

🎉 This PR is included in version 2.1.3 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@gr2m gr2m added the released label Oct 3, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants