From 76ef17e516f32c7dd6021109a10f08fbfcdd3b2d Mon Sep 17 00:00:00 2001 From: Nathan Lisgo Date: Fri, 31 Mar 2023 17:12:53 +0100 Subject: [PATCH] Allow mastodon in SocialMediaSharersNew (#1770) --- composer.lock | 8 ++++---- src/ViewModel/Converter/ArticleContentHeaderConverter.php | 4 +++- src/ViewModel/Converter/ArticleModalConverter.php | 4 +++- .../Converter/BlogArticleContentHeaderConverter.php | 3 ++- src/ViewModel/Converter/DigestContentHeaderConverter.php | 3 ++- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/composer.lock b/composer.lock index 0168a0013..7eef7199c 100644 --- a/composer.lock +++ b/composer.lock @@ -1333,12 +1333,12 @@ "source": { "type": "git", "url": "https://github.com/elifesciences/patterns-php.git", - "reference": "745774723e82d5b720afddfef43f96056a7b1a93" + "reference": "646034fa112fd61957ba24f52d2b0408cf0e0f43" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/elifesciences/patterns-php/zipball/745774723e82d5b720afddfef43f96056a7b1a93", - "reference": "745774723e82d5b720afddfef43f96056a7b1a93", + "url": "https://api.github.com/repos/elifesciences/patterns-php/zipball/646034fa112fd61957ba24f52d2b0408cf0e0f43", + "reference": "646034fa112fd61957ba24f52d2b0408cf0e0f43", "shasum": "" }, "require": { @@ -1379,7 +1379,7 @@ "support": { "source": "https://github.com/elifesciences/patterns-php/tree/master" }, - "time": "2023-03-31T10:34:00+00:00" + "time": "2023-03-31T15:00:46+00:00" }, { "name": "fabpot/goutte", diff --git a/src/ViewModel/Converter/ArticleContentHeaderConverter.php b/src/ViewModel/Converter/ArticleContentHeaderConverter.php index 6b636ecb9..57e381e25 100644 --- a/src/ViewModel/Converter/ArticleContentHeaderConverter.php +++ b/src/ViewModel/Converter/ArticleContentHeaderConverter.php @@ -76,7 +76,9 @@ public function convert($object, string $viewModel = null, array $context = []) '#cite-this-article', new ViewModel\SocialMediaSharersNew( strip_tags($object->getFullTitle()), - "https://doi.org/{$object->getDoi()}" + "https://doi.org/{$object->getDoi()}", + true, + true ), !empty($context['metrics']) ? ViewModel\ContextualData::withMetrics($context['metrics']) : null, null, diff --git a/src/ViewModel/Converter/ArticleModalConverter.php b/src/ViewModel/Converter/ArticleModalConverter.php index c3a071d04..2ba5f5d41 100644 --- a/src/ViewModel/Converter/ArticleModalConverter.php +++ b/src/ViewModel/Converter/ArticleModalConverter.php @@ -47,7 +47,9 @@ public function convert($object, string $viewModel = null, array $context = []) ViewModel\Button::clipboard('Copy to clipboard', "https://doi.org/{$object->getDoi()}"), new ViewModel\SocialMediaSharersNew( strip_tags($object->getFullTitle()), - "https://doi.org/{$object->getDoi()}" + "https://doi.org/{$object->getDoi()}", + true, + true ), ]; diff --git a/src/ViewModel/Converter/BlogArticleContentHeaderConverter.php b/src/ViewModel/Converter/BlogArticleContentHeaderConverter.php index 6fdfe3d5c..f4336c33c 100644 --- a/src/ViewModel/Converter/BlogArticleContentHeaderConverter.php +++ b/src/ViewModel/Converter/BlogArticleContentHeaderConverter.php @@ -44,7 +44,8 @@ public function convert($object, string $viewModel = null, array $context = []) new ViewModel\SocialMediaSharersNew( strip_tags($object->getTitle()), $this->urlGenerator->generate('inside-elife-article', [$object], UrlGeneratorInterface::ABSOLUTE_URL), - false + false, + true ), !empty($context['metrics']) ? ViewModel\ContextualData::withMetrics($context['metrics']) : null, null, diff --git a/src/ViewModel/Converter/DigestContentHeaderConverter.php b/src/ViewModel/Converter/DigestContentHeaderConverter.php index daef6175c..84ff0626d 100644 --- a/src/ViewModel/Converter/DigestContentHeaderConverter.php +++ b/src/ViewModel/Converter/DigestContentHeaderConverter.php @@ -47,7 +47,8 @@ public function convert($object, string $viewModel = null, array $context = []) new ViewModel\SocialMediaSharersNew( strip_tags($object->getTitle()), $this->urlGenerator->generate('digest', [$object], UrlGeneratorInterface::ABSOLUTE_URL), - false + false, + true ), !empty($context['metrics']) ? ViewModel\ContextualData::withMetrics($context['metrics']) : null, null,