Skip to content

Commit

Permalink
Change tweet to post (#1212)
Browse files Browse the repository at this point in the history
X made this change since tweets are now called posts. This commit also changes twitter.com to x.com
  • Loading branch information
mleray authored Jun 5, 2024
1 parent 646155e commit f4fe4ca
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion assets/src/blocks/ShareButtons/ShareButtonsFrontend.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const parseUrl = attrs => {
case 'facebook':
return `https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(attrs.url)}`;
case 'twitter':
return `https://twitter.com/share
return `https://x.com/share
?url=${encodeURIComponent(attrs.url)}
&text=${encodeURIComponent(attrs.text)}
${(attrs.description ? ' - ' + encodeURIComponent(attrs.description) : '')}
Expand Down
2 changes: 1 addition & 1 deletion assets/src/components/ShareButtons/ShareButtons.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const ShareButtons = ({social_params, social_accounts}) => {
};

const twitterUrl = (link, title, description, account) => {
return `https://twitter.com/share?url=${encodeURIComponent(link)}` +
return `https://x.com/share?url=${encodeURIComponent(link)}` +
`&text=${encodeURIComponent(title)}` +
(description ? ` - ${encodeURIComponent(description)}` : '') +
(account ? ` via @${encodeURIComponent(account)}&related=${encodeURIComponent(account)}` : '');
Expand Down
2 changes: 1 addition & 1 deletion public/js/social_media_cards.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ document.addEventListener( 'DOMContentLoaded', () => {
link.addEventListener( 'click', ( event ) => {
event.preventDefault();
openPopup(
`https://twitter.com/intent/tweet?text=${ encodeURIComponent( link.dataset.text ) }&url=${ encodeURIComponent( link.dataset.socialUrl ) }`
`https://x.com/intent/post?text=${ encodeURIComponent( link.dataset.text ) }&url=${ encodeURIComponent( link.dataset.socialUrl ) }`
);

return false;
Expand Down
2 changes: 1 addition & 1 deletion templates/blocks/social_media_cards.twig
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
target="_blank" class="facebook-share">
{{ "facebook"|svgicon }}
</a>
<a href="https://twitter.com/intent/tweet?url={{ card.social_url|default(post_url)|url_encode }}&text={{ card.message|url_encode }}"
<a href="https://x.com/intent/post?url={{ card.social_url|default(post_url)|url_encode }}&text={{ card.message|url_encode }}"
data-text="{{ card.message }}"
data-social-url="{{ card.social_url|default(post_url) }}"
title="{{ __('Share on Twitter', 'planet4-blocks') }}"
Expand Down

0 comments on commit f4fe4ca

Please sign in to comment.