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

Added new template mapping for using Rettiwt provider #1409

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ronaldlangeveld
Copy link
Member

@ronaldlangeveld ronaldlangeveld commented Jan 20, 2025

ENG-1792

  • Added new template mapping to utilize Rettiwt as a provider for embedding tweets.
  • Updated rendering logic to support Rettiwt's data structure and response format.
  • Implemented comprehensive tests to ensure reliability and compatibility.
  • Refactored functions for improved readability and maintainability.

@ronaldlangeveld ronaldlangeveld marked this pull request as ready for review January 20, 2025 05:27
Comment on lines +103 to +112
const tcoLinks = formattedContent.match(/https:\/\/t\.co\/[a-zA-Z0-9]+/g) || [];
const displayUrls = urls.map(urlObj => urlObj.display_url);
tcoLinks.forEach((tcoLink, index) => {
if (index < displayUrls.length) {
formattedContent = formattedContent.replace(
tcoLink,
wrapWithStyle(displayUrls[index], 'color: #1DA1F2; word-break: break-all;')
);
}
});
Copy link
Member Author

Choose a reason for hiding this comment

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

With Rettiwt we don't have the start / end positioning of links like we have with the official API, in order to replace the shortened link with the actual link for better aesthetics.
However we do get an array with the urls from the tweet eg ['https://url1.com', 'https://url2.com'] and based on manual experimenting they appear in the order of which links appear in a post - however I don't think that's guaranteed based on the documentation.

Do you think it's worth the risk of a potential bad render should the ordering not render in the order as expected?

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.

1 participant