From f0d52417fbcb3427065ec3b0b8cf33f12f368f8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 7 Oct 2016 09:05:18 +0200 Subject: [PATCH 1/3] Added OpenGraph support for public articles Fix #2289 --- .../CoreBundle/Resources/translations/messages.da.yml | 2 ++ .../CoreBundle/Resources/translations/messages.de.yml | 2 ++ .../CoreBundle/Resources/translations/messages.en.yml | 2 ++ .../CoreBundle/Resources/translations/messages.es.yml | 2 ++ .../CoreBundle/Resources/translations/messages.fa.yml | 2 ++ .../CoreBundle/Resources/translations/messages.fr.yml | 2 ++ .../CoreBundle/Resources/translations/messages.it.yml | 2 ++ .../CoreBundle/Resources/translations/messages.oc.yml | 2 ++ .../CoreBundle/Resources/translations/messages.pl.yml | 4 +++- .../CoreBundle/Resources/translations/messages.ro.yml | 2 ++ .../CoreBundle/Resources/translations/messages.tr.yml | 2 ++ .../Resources/views/themes/common/Entry/share.html.twig | 9 ++++++++- 12 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml index 40644ff5f..15d0c025d 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml @@ -208,6 +208,8 @@ entry: url_label: 'Url' # is_public_label: 'Public' save_label: 'Gem' + # public: + # shared_by_wallabag: "This article has been shared by wallabag" about: page_title: 'Om' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml index 130ab2cdd..4db49b2fd 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml @@ -208,6 +208,8 @@ entry: url_label: 'URL' is_public_label: 'Öffentlich' save_label: 'Speichern' + # public: + # shared_by_wallabag: "This article has been shared by wallabag" about: page_title: 'Über' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml index 91abe1623..cf3aedae3 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml @@ -208,6 +208,8 @@ entry: url_label: 'Url' is_public_label: 'Public' save_label: 'Save' + public: + shared_by_wallabag: "This article has been shared by wallabag" about: page_title: 'About' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml index 25d2f3a25..0b8fe3982 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml @@ -208,6 +208,8 @@ entry: url_label: 'Url' is_public_label: 'Es Público' save_label: 'Guardar' + # public: + # shared_by_wallabag: "This article has been shared by wallabag" about: page_title: 'Acerca de' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml index b02ffea02..fcdd29bb7 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml @@ -208,6 +208,8 @@ entry: url_label: 'نشانی' is_public_label: 'عمومی' save_label: 'ذخیره' + # public: + # shared_by_wallabag: "This article has been shared by wallabag" about: page_title: 'درباره' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index 598205b02..26f5a3386 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml @@ -208,6 +208,8 @@ entry: url_label: 'Url' is_public_label: 'Public' save_label: 'Enregistrer' + public: + shared_by_wallabag: "Cet article a été partagé par wallabag" about: page_title: 'À propos' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml index c58c929f7..6cc98b901 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml @@ -208,6 +208,8 @@ entry: url_label: 'Url' is_public_label: 'Pubblico' save_label: 'Salva' + # public: + # shared_by_wallabag: "This article has been shared by wallabag" about: page_title: 'About' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml index 8f06434db..4ef1be384 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml @@ -208,6 +208,8 @@ entry: url_label: 'Url' is_public_label: 'Public' save_label: 'Enregistrar' + # public: + # shared_by_wallabag: "This article has been shared by wallabag" about: page_title: 'A prepaus' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml index 7f28e648d..46cb1c12f 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml @@ -208,6 +208,8 @@ entry: url_label: 'Adres URL' is_public_label: 'Publiczny' save_label: 'Zapisz' + # public: + # shared_by_wallabag: "This article has been shared by wallabag" about: page_title: 'O nas' @@ -284,7 +286,7 @@ quickstart: import: 'Skonfigurować import' first_steps: title: 'Pierwsze kroki' - description: "Teraz wallabag jest poprawnie skonfigurowany, więc czas zarchiwizować Internet. Klinknij w prawym górnym rogu na znak +, aby dodać link" + description: "Teraz wallabag jest poprawnie skonfigurowany, więc czas zarchiwizować Internet. Klinknij w prawym górnym rogu na znak +, aby dodać link" new_article: 'Zapisz swój pierwszy artukuł' unread_articles: 'I sklasyfikuj go!' migrate: diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml index 4e0e454c1..8b5179b0f 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml @@ -208,6 +208,8 @@ entry: url_label: 'Url' # is_public_label: 'Public' save_label: 'Salvează' + # public: + # shared_by_wallabag: "This article has been shared by wallabag" about: page_title: 'Despre' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml index 02b3aae62..5e49c9213 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml @@ -207,6 +207,8 @@ entry: url_label: 'Url' is_public_label: 'Herkes tarafından erişime açık olsun mu?' save_label: 'Kaydet' + # public: + # shared_by_wallabag: "This article has been shared by wallabag" about: page_title: 'Hakkımızda' diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/common/Entry/share.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/common/Entry/share.html.twig index b82b3d3d8..bf44ced76 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/common/Entry/share.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/common/Entry/share.html.twig @@ -27,11 +27,18 @@ width: 600px; } + + + + {% if entry.previewPicture is not null %} + + {% endif %}

{{ entry.title | raw }}

- {{ entry.domainName|removeWww }} +
{{ entry.domainName|removeWww }}
+
{{ "entry.public.shared_by_wallabag"|trans|raw }}
{{ entry.content | raw }} From d0d196ffb34929de6c915c0b34375f3af6135747 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 7 Oct 2016 09:22:40 +0200 Subject: [PATCH 2/3] Fixed review --- .../CoreBundle/Resources/translations/messages.da.yml | 4 ++-- .../CoreBundle/Resources/translations/messages.de.yml | 4 ++-- .../CoreBundle/Resources/translations/messages.en.yml | 2 +- .../CoreBundle/Resources/translations/messages.es.yml | 4 ++-- .../CoreBundle/Resources/translations/messages.fa.yml | 4 ++-- .../CoreBundle/Resources/translations/messages.fr.yml | 2 +- .../CoreBundle/Resources/translations/messages.it.yml | 4 ++-- .../CoreBundle/Resources/translations/messages.oc.yml | 4 ++-- .../CoreBundle/Resources/translations/messages.pl.yml | 4 ++-- .../CoreBundle/Resources/translations/messages.ro.yml | 4 ++-- .../CoreBundle/Resources/translations/messages.tr.yml | 4 ++-- .../Resources/views/themes/common/Entry/share.html.twig | 2 +- 12 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml index 15d0c025d..010670354 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml @@ -208,8 +208,8 @@ entry: url_label: 'Url' # is_public_label: 'Public' save_label: 'Gem' - # public: - # shared_by_wallabag: "This article has been shared by wallabag" + public: + # shared_by_wallabag: "This article has been shared by wallabag" about: page_title: 'Om' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml index 4db49b2fd..50195b058 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml @@ -208,8 +208,8 @@ entry: url_label: 'URL' is_public_label: 'Öffentlich' save_label: 'Speichern' - # public: - # shared_by_wallabag: "This article has been shared by wallabag" + public: + # shared_by_wallabag: "This article has been shared by wallabag" about: page_title: 'Über' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml index cf3aedae3..2aba86ff7 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml @@ -209,7 +209,7 @@ entry: is_public_label: 'Public' save_label: 'Save' public: - shared_by_wallabag: "This article has been shared by wallabag" + shared_by_wallabag: "This article has been shared by wallabag" about: page_title: 'About' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml index 0b8fe3982..b74955109 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml @@ -208,8 +208,8 @@ entry: url_label: 'Url' is_public_label: 'Es Público' save_label: 'Guardar' - # public: - # shared_by_wallabag: "This article has been shared by wallabag" + public: + # shared_by_wallabag: "This article has been shared by wallabag" about: page_title: 'Acerca de' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml index fcdd29bb7..137635648 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml @@ -208,8 +208,8 @@ entry: url_label: 'نشانی' is_public_label: 'عمومی' save_label: 'ذخیره' - # public: - # shared_by_wallabag: "This article has been shared by wallabag" + public: + # shared_by_wallabag: "This article has been shared by wallabag" about: page_title: 'درباره' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index 26f5a3386..098bc9ffc 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml @@ -209,7 +209,7 @@ entry: is_public_label: 'Public' save_label: 'Enregistrer' public: - shared_by_wallabag: "Cet article a été partagé par wallabag" + shared_by_wallabag: "Cet article a été partagé par wallabag" about: page_title: 'À propos' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml index 6cc98b901..390a4b60d 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml @@ -208,8 +208,8 @@ entry: url_label: 'Url' is_public_label: 'Pubblico' save_label: 'Salva' - # public: - # shared_by_wallabag: "This article has been shared by wallabag" + public: + # shared_by_wallabag: "This article has been shared by wallabag" about: page_title: 'About' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml index 4ef1be384..990938a65 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml @@ -208,8 +208,8 @@ entry: url_label: 'Url' is_public_label: 'Public' save_label: 'Enregistrar' - # public: - # shared_by_wallabag: "This article has been shared by wallabag" + public: + # shared_by_wallabag: "This article has been shared by wallabag" about: page_title: 'A prepaus' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml index 46cb1c12f..6dd79641c 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml @@ -208,8 +208,8 @@ entry: url_label: 'Adres URL' is_public_label: 'Publiczny' save_label: 'Zapisz' - # public: - # shared_by_wallabag: "This article has been shared by wallabag" + public: + # shared_by_wallabag: "This article has been shared by wallabag" about: page_title: 'O nas' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml index 8b5179b0f..a8d625d24 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml @@ -208,8 +208,8 @@ entry: url_label: 'Url' # is_public_label: 'Public' save_label: 'Salvează' - # public: - # shared_by_wallabag: "This article has been shared by wallabag" + public: + # shared_by_wallabag: "This article has been shared by wallabag" about: page_title: 'Despre' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml index 5e49c9213..bcfd8ad41 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml @@ -207,8 +207,8 @@ entry: url_label: 'Url' is_public_label: 'Herkes tarafından erişime açık olsun mu?' save_label: 'Kaydet' - # public: - # shared_by_wallabag: "This article has been shared by wallabag" + public: + # shared_by_wallabag: "This article has been shared by wallabag" about: page_title: 'Hakkımızda' diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/common/Entry/share.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/common/Entry/share.html.twig index bf44ced76..36c49e042 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/common/Entry/share.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/common/Entry/share.html.twig @@ -38,7 +38,7 @@

{{ entry.title | raw }}

{{ entry.domainName|removeWww }}
-
{{ "entry.public.shared_by_wallabag"|trans|raw }}
+
{{ "entry.public.shared_by_wallabag"|trans({'%wallabag_instance%': url('homepage')})|raw }}
{{ entry.content | raw }} From 21d82c3c5d211ee3e30cf71d2de3ebac0d63da54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 7 Oct 2016 14:06:12 +0200 Subject: [PATCH 3/3] Added test for OpenGraph --- tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php index c40e10a50..03267e768 100644 --- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php @@ -753,7 +753,7 @@ class EntryControllerTest extends WallabagCoreTestCase $this->assertCount(2, $crawler->filter('div[class=entry]')); } - public function testCache() + public function testShareEntryPublicly() { $this->logInAs('admin'); $client = $this->getClient(); @@ -778,6 +778,9 @@ class EntryControllerTest extends WallabagCoreTestCase $this->assertContains('public', $client->getResponse()->headers->get('cache-control')); $this->assertContains('s-maxage=25200', $client->getResponse()->headers->get('cache-control')); $this->assertNotContains('no-cache', $client->getResponse()->headers->get('cache-control')); + $this->assertContains('og:title', $client->getResponse()->getContent()); + $this->assertContains('og:type', $client->getResponse()->getContent()); + $this->assertContains('og:url', $client->getResponse()->getContent()); // sharing is now disabled $client->getContainer()->get('craue_config')->set('share_public', 0);